Posts

Showing posts from February, 2014

How to convert string to datetime object in python for years 2070 and above? -

while trying convert string datetime , encountered following: s='30-01-50' datetime.datetime.str >>datetime.date(2050, 1, 30) however s='30-01-70' datetime.datetime.strptime(s,"%d-%m-%y").date() >>datetime.date(1970, 1, 30) why not 2070 ?. how 1 perform arithmetic on such datetime values? for quick reference, see this answer . quick answer: not use two-digit years, use four-digit years , %y specifier.

javascript - Why is my Material Design collapsible list expandable animation not working? -

i'm using material design on website , have sort of comment section made collapsible list. want user able open several comments setting collapsible mode 'expandable'. want sliding animation open new comment not work. displays comment whitout animations. if want close (by clicking it), slides again. so slides (when closing), not down (when opening). example: expandable list @ bottom of this page. as can see, have collapsible list expandable. (i'm using razor dynamiclly set content) view: <ul class="collapsible" data-collapsible="expandable"> @foreach (var item in model) { <li> <div class="collapsible-header"> //comment preview , date here... </div> <div class="collapsible-body"> //display comment text etc here... </div> </li> } </ul> and js initialization in do

The result of PHP code is wrong? -

when tried make simple php code, had problem result had showed things weren't expected such " ' . "\n"; echo' ". code wrong? here code: <html> <head> <title>putting data in db</title> </head> <body> <?php /*insert students db*/ if(isset($_post["submit"])) { $db = mysql_connect("mysql", "martin"); mysql_select_db("martin"); $date=date("y-m-d"); /* current date in right sql format */ $sql="insert students values(null,'" . $_post["f_name"] . "','" . $_post["l_name"] . "'," . $_post["student_id"] . ",'" . $_post["email"] . "','" . $date . "'," . $_post["gr"] . ")"; /* construct query */ mysql_query($sql); /* execute query */ mysql_close(); echo"<h3>thank you. data has been entered.</h3>

calendar - Android Library for a Week View Scheduler (no dates) -

Image
so developing android app version of our campus student portal. so there exists feature shows "schedule" of classes 1 student has, , looks in web app equivalent: the problem is, have yet find existing library conforms feature. see calendars week views, exact dates. i need simple scheduler days of sunday - saturday, timetable @ row headers, , no months, dates, or years shown exact. also because whole timetable seems space costly, efficient view instead shows timetable 1 day only, upon scrolling left or right, navigates other days. one library came close alamkanak's week view , there's week view limits show 1 day within viewport, still shows date, unnecessary. do have library suggestions fits feature is? or workaround modification existing library (like 1 above) changes show week view only no dates , time table. use xml file <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://sch

sql server - How would you write a T-SQL query that supported event study analysis -

Image
i trying create table support simple event study analysis, i'm not sure how best approach this. i'd create table following columns: customer, date, time on website, outcome. i'm testing premise outcome particular customer on give day if function of time spent on website on current day preceding 5 site visits. i'm envisioning table similar this: i'm hoping write t-sql query produce output this: given objective, here questions: assuming indeed possible, how should structure table accomplish objective? there need column refers prior visit? need add index particular column? would considered recursive query? given appropriate table structure, query like? is possible structure query variable determines number of prior periods include in addition current period (for example, if want compare 5 periods 3 periods)? not sure understand analytic value of matrix declare @table table (id int,visitdate date,visittime int,outcome varchar(25)) insert

android - ListView Checkbox repeated every 4th items -

i have listview filled checkboxes. when click on checkbox, 4th checkbox , multiplications (8th, 12th, etc..) checked automatically without me clicking on them. updated code public class caractivity extends activity implements downloadresultreceiver.receiver { private downloadresultreceiver mreceiver; list<item> items; string carnumber; /** * attention: auto-generated implement app indexing api. * see https://g.co/appindexing/androidstudio more information. */ private googleapiclient client; @override protected void oncreate(bundle savedinstancestate) { button submit; super.oncreate(savedinstancestate); setcontentview(r.layout.activity_car); bundle b = this.getintent().getextras(); string url = b.getstring("url"); carnumber = b.getstring("carnumber"); string model = b.getstring("model"); final string category = b.getstring(&qu

jquery - Javascript code to fade the output after 1 second -

i trying display dimensions of window , able it: all want fade output text after 1 second after resize happened; possible? $(window).on('resize', showsize); showsize(); function showsize() { $('#size').html($(window).height() + 'px x ' + $(window).width() + 'px'); } $(window).on('resize', showsize); showsize(); function showsize() { $('#size').show(); // show $('#size').html($(window).height() + 'px x ' + $(window).width() + 'px'); settimeout(function(){ $('#size').fadeout(); // hide after 1 second }, 1000); } updated fiddle: https://jsfiddle.net/r1vmjxx9/2/

php - Update from URL -

i have been working towards updating password after request has been sent , collected email, request part seems work when try update password nothing seems happen, password length set @ 255, checked if correct id getting , seems be, when manually run query in easyphp adding want updated seems work, have looked @ network response no errors showing , checked error logs nothing there either. advice great. <?php require_once'connection.php'; $userinput = new userinput(); $userinput->triminput(); $id = ''; if( isset( $_get['reset'])) { $id = $_get['reset']; } header('content-type: application/json'); $errors = []; if (empty($_session['resetpassword'])) { $_session['resetpassword'] = 1; } else { $_session['resetpassword']++; } if($_session['resetpassword'] > 3){ $errors[]= ["name"=>"usernam

How to check EditText isEmpty in Android -

i want create login page , used edittext insert user info. want check edittext see if empty invisible login button, when inserted character user visible login button. tried code shown below, did not not work me : //show login button string login_phonestring = login_phonetext.gettext().tostring().trim(); if (login_phonestring.isempty()) { login_image.setvisibility(view.invisible); } else { login_image.setvisibility(view.visible); } when edittext empty, button invisible, , when set character in edittext again login button not shown. how can fix problem ? you want show/hide login button base on text of edittext need listen changing in edittext use textwatcher . use code inside oncreate() method login_phonetext.addtextchangedlistener(new textwatcher() { public void aftertextchanged(editable s) { string login_phonestring = login_phonetext.gettext().tostring().trim(); if (login_phonestring.isempty()) {

php - yii2: working with yii2-sitemap-module -

i used https://github.com/himiklab/yii2-sitemap-module in yii2 project this console : return [ 'id' => 'basic-console', 'language' => 'fa-ir', 'basepath' => dirname(__dir__), 'bootstrap' => ['log', 'gii'], 'controllernamespace' => 'app\commands', 'modules' => [ 'gii' => 'yii\gii\module', 'user' => [ 'class' => 'dektrium\user\module', 'sourcelanguage' => 'en-us', 'languages' => 'fa-ir' ], 'sitemap' => [ 'class' => 'himiklab\sitemap\sitemap', 'models' => [ // models 'app\modules\news\models\news', // or configuration creating behavior [ 'cla

sql - How to extract only numbered rows from a column -

for e.g: have column named "card no", varchar majority of rows contain numbers , few contains alphanumeric numbers. want ignore records not numbers. below few examples same: select cardno xx; result: cardno: _______ 1234, 5467, 1234/5467, abc 667, efg428 in above result set, want eliminate last 3 values. please advise. select cardno xx translate(cardno, ' 0123456789', ' ') null

Replace a 404-page that appears on google -

i have website wwww.website.com/url displayed on google when use keyword. i have replaced url www.website.com/url-new. when search on same keyword old url being displayed on google, normal. my question is: how change old url being dispalyed on google? there can on webmasterstool speed up? i have tried use "get google" in webmasterstool index new url. there more can do? you have use google webmastertools, located here: here redirect links different links , on. check out.

activerecord - OR clause in Rails 5 -

how can (a || b) && ( c || d) query in rails 5 activerecord?. tried post.where(a).or(post.where(b)).where(c).or(post.where(d)) but produces as: (a || b) && c || d . correct code desired query? the rails or() method not complex this. there long discussion feature when first proposed here, on github this method meant provide convenient way of railsifying queries, sometimes, things cannot simple. or() method stuck reading left-to-right. your best bet while sticking "railsy" convention follow 1 of following approaches: post.where("a or b").where("c or d") # example 1 - sql additional where() post.where(a: [true, !b]).where(c: [true, !d]) # example 2 - array comparison post.where("(a or b) , (c or d)") # example 3 - sql

dom - How can I list the contents of all the <p> elements in the console using JavaScript? -

i'm trying log content of <p> elements in console pressing on button here code far. window.addeventlistener("load",init); function init(){ var b = document.getelementbyid("btn2") b.addeventlistener("click",action) } function action(){ var i, items = document.qetelementsbytagname("p"); (i = 0; < items.length; i++) { console.log(items[i]); } } get content using innerhtml or textcontent property console.log(items[i].innerhtml); //or console.log(items[i].textcontent);

Wake up WiFi in Android -

i have intentservice called wakefulbroadcastreceiver woken alarmmanager every 8 hours. so alarmmanager -> wakefulbroadcastreceiver -> intentservice . the wakefulbroadcastreceiver gets partial_wake_lock starts. problem wifi goes sleep between runs of intentservice , partial_wake_lock doesnt seem wake up. i know wifi has wake lock grabbing doesnt seem wake wifi how can wake it? (and can take lock make sure wont go sleep again).

Grouping MySQL data by which day of the week it is -

i'm attempting separate database entries number of entries fall on each day of week (mon=43, tue=35...) no regard month or year. result query below return 8 results instead of 7 , number of results each day incorrect. select count(*) table group dayofweek(date) example of table: date 07/11/13 07/16/13 07/17/13 07/24/13 07/26/13 07/26/13 am using dayofweek correctly? i suggest change query follow: select dayofweek(date), count(*) table group dayofweek(date) so can better understand if there's wrong, anyway: yes you're using dayofweek correctly. bit surprised fact 8 results... can show results please? gnagno

Setup Ruby app on cPanel shared hosting -

what i'm trying deploy ruby on rails app on cpanel shared hosting. i'm new cpanel or web hosting. following guides managed upload app when run it, gives me following passenger error: cannot load such file -- bundler/setup (loaderror) any response appreciated, in advance. what have done far: cpanel's setup ruby app function you need install bundler module

angularjs - req.body.stripeToken is undefined -

i'm trying use $http post form nodejs server. when post, go server , try variable stripetoken using req.body.stripetoken, returns undefined. when try post request using method="post" , action="http://localhost:3000/api/posts" attributes on form in html file, works charm. reason believe server side code ok, there wrong $http request. i've read several posts problem, have yet see working solution me. solutions other posts: define configurations before define routes in server file. add body-parser middleware in server file. define headers http request. i have tried these solutions, none worked. ofcourse can use method works, since i'm using angularjs using $http. $http post request: $http({ method: 'post', url: 'http://localhost:3000/api/posts', data: form.get(0), headers: { 'content-type': 'application/x-www-form-urlencoded' } }).

Saving Drawable reference into SQLite Database -

i want save reference (the integer) of .png files saved in /drawable folder in android app. i wish use them searchmanager.suggest_column_icon_1 in suggestions list, therefore address needs stored in db. knowing name of file (for example: fruitsicon.png) value should save in database, in order specify column suggest_column_icon_1? i insert in db column android.resource://com.mydomain.appname/drawable/icon1 it worked

javascript - How to prevent accidental deletion of contenteditable ul in IE10? -

i want have contenteditable ul on page. however, in internet explorer 10, if click it, select either right click menu or ctrl+a, delete, ul element gets deleted off page. what best way prevent this, or @ least detect when happens , insert replacement ul? i'd suggest intercepting delete , backspace keys , doing delete manually. steps are: get selected range adjust ends of range lie within editable <ul> element if outside call deletecontents() on range. note following won't work on ie <= 8. if need support browsers, use rangy library, used simplify deleteselectedcontent() slightly. demo: http://jsfiddle.net/timdown/stcxa/3/ code: var editor = document.getelementbyid("editor"); function deleteselectedcontent() { if (window.getselection) { var sel = window.getselection(); if (sel.rangecount > 0) { var range = sel.getrangeat(0); var editorrange = range.clonerange(); editor

Converting DOS text files to Unicode using Python -

i trying write python application converting old dos code page text files unicode equivalent. now, have done before using turbo pascal creating look-up table , i'm sure same can done using python dictionary. question is: how index dictionary find character want convert , send equivalent unicode unicode output file? i realize may repeat of similar question nothing searched here quite matches question. python has codecs conversions: #!python3 # test file bytes 0-255. open('dos.txt','wb') f: f.write(bytes(range(256))) # read file , decode using code page 437 (dos oem-us). # write file utf-8 encoding ("unicode" not encoding) # utf-8, utf-16, utf-32 encodings support unicode codepoints. open('dos.txt',encoding='cp437') infile: open('unicode.txt','w',encoding='utf8') outfile: outfile.write(infile.read())

Calling a script from wxpython and sending user input data during the run -

i writing gui quadrotor simulator using wxpython. trying call main program button click calls script main.py sending initial data, while keeping gui responsive , send user input data main script. there simple way achieve without sending information through socket? if want communicate between 2 separate scripts, socket server 1 of easiest ways go. wrote tutorial on topic here: http://www.blog.pythonlibrary.org/2013/06/27/wxpython-how-to-communicate-with-your-gui-via-sockets/ you use other server backends if need more robust. if want advanced, might want @ rabbitmq, think that's overkill project.

c++ - SDL2 draw and fill shapes -

how can draw different shapes (other rectangle , line) , fill them using sdl2 in c++? tried using sdl2_gfx, couldn't sdl2_gfx compiled, coudnt't try it. found compiled sdl_gfx since i'm using renderer not surfaces can't use it. drawing polygons simple, can calculate point , draw lines, how fill them? , how draw circle? if has compiled sdl2_gfx (same way sdl2_ttf , sdl2_image) maybe send me? thank :)! if want fill polygon quick google search gives efficient algorithm here . or copying way sdl2_gfx possible, have access sources? for drawing circle, there the midpoint circle algorithm code given: void drawcircle(int x0, int y0, int radius) { int x = 0, y = radius; int dp = 1 - radius; { if (dp < 0) dp = dp + 2 * (++x) + 3; else dp = dp + 2 * (++x) - 2 * (--y) + 5; putpixel(x0 + x, y0 + y, 15); //for 8 octants putpixel(x0 - x, y0 + y, 15); putpixel(x0 + x, y0 - y, 1

bash - How ${@: -1} expand to last argument -

i knows ${para:[start]:[length]} , $@ notation i'm unable find out how ${var: -1} evaluates last argument. consider length - 1 resolve in last character in $var . same goes ${var:(-2)} , ...: var='hello' printf "%s\n" "${var:(-1)}" # o printf "%s\n" "${var:(-2)}" # lo printf "%s\n" "${var:(-3)}" # llo

android - center items horizontally in RecyclerView(using GridLayoutManager) -

Image
i'm trying center items horizontally each row in recyclerview i tried many things: relativelayout parent, use layout_centerinparent, use basic android:layout_gravity="center", try add space element,using weights , .... in item_row.xml didn't succeed :( what have what want in activity recyclerview.setlayoutmanager(new gridlayoutmanager(this, 3)); item_row.xml <android.support.v7.widget.cardview xmlns:android="http://schemas.android.com/apk/res/android" xmlns:card_view="http://schemas.android.com/apk/res-auto" android:id="@+id/cardview" android:layout_width="wrap_content" android:layout_height="wrap_content" card_view:cardcornerradius="2dp" card_view:cardelevation="4dp" card_view:cardusecompatpadding="true"> <!-- recycler view item row --> <linearlayout android:layout_width="wrap_content" android:layout_height="wrap_content&q

ios - Stacked UINavigationController -

i'm new in ios , i'm working storyboards. i have application views. my rootviewcontroller (1) uinavigationcontroller connects other views. @ 1 point in application (2), include component (swrevealviewcontroller, facebook side menu style) instance of uinavigationcontroller, have 2 uinavigationcontrollers nested within each other. want remove or change first uinavigationcontroller new 1 (2), , have one. views accessed via custom segues. detailed image here i think solution change rootviewcontroller before loading view (2), , set second uinavigationcontroller main of application. detailed image here i tried solve accessing by: [uiapplication delegate].window.rootviewcontroller = mycontroller; but have nil or empty window. i read many post solution in appdelegate in method - (void) applicationdidfinishlaunching: (uiapplication *) application can't understand how apply structure, because method called when application launched. i think workflow appl

javascript - Using chai-as-promised and chai-bignumber together fails -

the following call filestore.getblocknumber.q(filehash).should.eventually.bignumber.equal(blocknumber) fails with assertionerror: expected { state: 'pending' } instance of string, number or bignumber i can reproduce issue, , fix changing order in plugins used: chai.use(require('chai-bignumber')); chai.use(require('chai-as-promised'));

redirect - Mod_rewrite is not working in apache -

i have configured apache http webserver 2.2.29 proxy. it's function redirect incoming request backend server. below flow. client sends request using url https://iproxy.company.co.uk:8443/cis1 . apache instance listening on iproxy.company.co.uk:8443 . request has sent backend server on url https://i.company.co.uk:8443 . achieve have used mod_rewrite. below configured in httpd-alias.conf file. `listen iproxy.company.uk:8443 servername iproxy.company.uk:8443 documentroot /app/ rewriteengine on rewriterule (.*)$ https://i.company.co.uk:8443$1 [r=301,l] proxypassreverse "/products/widget/" "http://product.example.com/widget/" rewritelog /app/instance1/logs/rewrite.log rewriteloglevel 5 errorlog "/app/instance1/logs/error_log" transferlog "/app/instance1//logs/access_log" sslengine on sslprotocol -sslv2 -sslv3 sslciphersuite high:!medium:!anull:!md5:!rc4 sslcertificatefil

grails - GORM: Is it possible to load a domain object with errors? -

recently we've had new requirement check our domain objects errors after load them database la: domaintype domain = domaintype.get(longdomaintypeid) we must add error check on loaded domain: if(domain.haserrors()) { //report errors , return failed } if database constraints same domain constraints (not null, varchar length, etc) how possible have load error? check validate database connection still valid? i'm curious know possibly expect go wrong here not catastrophic app/db connection failure... there 2 types of gorm constraints those enforced @ database layer, e.g. nullability, max length those enforced programatically, e.g. implemented custom validators assuming db schema in synch with gorm constraints it's possible data in database rejected (2) if: data written database isn't validated gorm constraints of type (2) added without performing correct data migration beforehand

java - How to link two Jlist with a MouseClick event -

in code i'm creating jlist , b , i'm trying construct jlist depending on user click( or b ). if user clicks want list2 appear in frame. if clicks b list3 must appear. right have click frame in order list appear. can explain me how possible , what's wrong code? import java.awt.*; import java.awt.event.*; import javax.swing.*; public class test extends jframe implements mouselistener { private static jlist list1 = new jlist(); private static jlist list2 = new jlist(); private static jlist list3 = new jlist(); private static jpanel jp1; private static jscrollpane listscroller2,listscroller3; private defaultlistmodel listmodel1,listmodel2,listmodel3; public test() { settitle("menu"); jtabbedpane jtp = new jtabbedpane(); setsize(600,600); getcontentpane().add(jtp); jp1 = new jpanel(); jp1.setlayout(new borderlayout()); listmodel1 = new defaultlistmodel(); listmodel1.addelement("

angularjs - Ionic BarcodeScanner does not work on ios -

Image
i created ionic app, work on android good. barcode scanner not working correct in ios. my code; $cordovabarcodescanner.scan().then(function (barcodedata) { console.log("data : "+barcodedata.text); }); but xcode giving me non-stop; when tried this; cordova.plugins.barcodescanner.scan( function (result) { alert("we got barcode\n" + "result: " + result.text + "\n" + "format: " + result.format + "\n" + "cancelled: " + result.cancelled); }, function (error) { alert("scanning failed: " + error); }, { "preferfrontcamera" : true, // ios , android "showflipcamerabutton" : true, // ios , android "prompt" : "place barcode inside scan area", // supported on android "formats" : "qr_code,pdf_417", // default: pdf_417 , rss_expanded "orientation"

javascript - How to render block of 'escaped' HTML returned in JSON response -

i'm beginner programmer trying make simple meteor app whereby can display data site of mine through rest api (the site runs on joomla , i'm using jbackend rest api - context , doesn't apply question) when send request , receive response, json returned gives me content of article huge html block - { "status": "ok", "id": "23", "title": "the ivy", "alias": "the-ivy2", "featured": "0", "content": "<div class=\"venue-intro\">\r\n\t<h1>\r\n\t\t\t\t\t<a href=\"index.php?option=com_content&view=article&id=23:the-ivy2&catid=14:leisure-activites\" title=\"the ivy\">\r\n\t\t\t\t\tthe ivy\r\n\t\t\t\t\t</a>\r\n\t\t\t</h1>\r\n\r\n\t<div class=\"row\">\r\n\t\t<div class=\"col-md-5\">\r\n\t\t\t\t\t\t\t<div class=\"venue-intro-img\">\r\n\t

java - Cannot add function "OnClickListener" to ImageButton -

here java code: public class mainpage extends appcompatactivity implements navigationview.onnavigationitemselectedlistener { tablayout tablayout; viewpageadapter viewpageadapter; viewpager viewpager; imagebutton pfp; bitmap bitmap_one; private string upload_url = "http://.php"; private int pick_image_request = 1; private string key_image = "image"; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main_page); inittypeface(); //id's pfp = (imagebutton) findviewbyid(r.id.imagebutton_one); pfp.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { if (v == pfp){ showfilechooser(); } } }); //searchintent intent searchi = getintent(); if (intent.action_search.equals(searchi.getaction())) { string query = searchi.getstringextra(searchmanage

c# - Quickest way to concatenate all String elements from List to String -

i have large amount of user objects on website, each containing list of forums administrate. have created page display paginated list of users administrate forum of forum names. so example travis - ftb, scr, swm, bsb tom - ftb, scr, swm, bsb, trk, bsk however users may administrate on 300 different topics , causing pages long time process. i have tried following ways process faster, of them taking same amount of time (too long). //join topicstring = string.join(", ", user.topics) (note topics.tostring returns 3 character id) //stringbuilder stringbuilder stringbuilder = new stringbuilder(3*user.topics.count() + 2*user.topics.count()); foreach(var topic in user.topics) { stringbuilder.append(topic.code); stringbuilder.append(", "); } codes = stringbuilder.tostring(); codes = codes.remove(codes.length-2); //classic concatenation foreach(var topic in user.topics) { codes += topic.code; codes += ", "; } codes = codes.remove(cod

javascript - Chrome Extension Paste into input element -

lets imagine have simple page. following content. <form> <input type="text" id="starttext"> </form> i have chrome extension script triggers on page loading. have configured relevant permission in chrome (i.e. clipboardread). script triggers on page load called action.js. has single line of code: document.getelementbyid("starttext").value = "text"; i know can use "execcommand('paste')" function paste within chrome extension. can't figure out how modify above code, pastes contents of user's clipboard input element. i try like: document.getelementbyid("starttext").value.execcommand('paste') but that, unsurprisingly, not work. the clipboard can accessed via background pages, due security reasons. problem background pages cannot interact dom, content scripts can. check out this gist , solves problem messages passing between background page , content scrip

How to remove variable from last iteration of while loop in python -

im not expert @ python , ive got following while loop. padding iterations buffer. however, results in unwanted padding in last iteration of while loop. there way can remove this? # send data packets. bytes_sent = 0 while (bytes_sent < len(padded_buf)): bytes_to_send = len(padded_buf) - bytes_sent assert bytes_to_send % 4 == 0 bytes_this_block = min(_max_block_size, bytes_to_send) s.send(padded_buf[bytes_sent:(bytes_sent + bytes_this_block)]) bytes_sent += bytes_this_block # clean , return. s.close() return bytes_sent cheers helps. i'm not sure you're trying remove… whatever is, can easily. if want remove after fact, can. of variables define inside while loop still available after done, value last iteration. can this: padded_buf = padded_buf[:-bytes_this_block] but really, better not add in first place. put if statement in middle of while , break if you've reached end.

python - Is it possible to check for db updates before performing db.rollback() within a worker transaction? -

i'm using queue queue transactions mysql database in python. i'm using autocommit=false can rollback transaction if not of data queries executed properly. i'm wondering whether it's possible check whether worker has performed action on database before performing db.rollback()? or can perform db.rollback if worker hasn't done database without errors occurring? thanks! if i've understood question correctly, not error rollback transaction nothing else has happened, although is error attempt rollback when no transaction exists. tell case can test mysqlconnection.in_transaction property .

iphone - Cannot add icon to registered document type? Is this a bug? -

Image
i trying add icons document type have defined using xcode document type option on project info. see phrase add icons here ? in theory can drop icons area. have tried png, ico, icns. nothing. i have tried add icons clicking on + there, nope. click on + , choose files , nothing happens. the icon see there able drop place is, droppable place. my problem this: i have dropped 320x320 png place see icon. i use following code obtain icon @ run time , display it. uidocumentinteractioncontroller* doccontroller = [[uidocumentinteractioncontroller alloc] init]; doccontroller.name = [nsstring stringwithformat:@"x.%@", [[fileurl path] pathextension]]; // x, can nsarray *icons = (nsarray *)[doccontroller icons]; the array has 2 icons, both same size 37x48 in size (???!!!) two questions can confirm if bug , there no way add icons there? can confirm if code have use icon? apple documentation vague. don't know if these icons have have special nomenclature

Excel VBA - Loop through a column of cells and search for each cell value in the workbook -

i need create macro loops through list of selected cells containing strings , takes each string , searches entire workbook string. if string found, sub should exit , found string should selected otherwise move on next string found until end of list. when run code sub not exit when string in list found , not go cell. option explicit dim sheetcount integer dim datatofind sub button1_click() find_file end sub private sub find_file() dim c range dim counter integer dim currentsheet integer dim notfound boolean notfound = true each c in selection.cells on error resume next currentsheet = activesheet.index datatofind = strconv(c.value, vblowercase) if datatofind = "" exit sub sheetcount = activeworkbook.sheets.count if iserror(cdbl(datatofind)) = false datatofind = cdbl(datatofind) counter = 1 sheetcount sheets(counter).activate cells.find(what:=datatofind, after:=activecell, lookin:=xlvalues, lookat _ :=xlpart, sear

mysqli - My insert doesn't work but i don't get any errors -

my mysqli insert doesn't work reason don't errors. <?php $con=mysqli_connect("localhost","root","","dice"); if (mysqli_connect_errno()) { echo "failed connect mysql: " . mysqli_connect_error(); } mysqli_query($con,"insert `gamble` (thr,score,tstamp) values ('test123','test123','test123')"); echo "new record has id: " . mysqli_insert_id($con); mysqli_close($con); ?> i don't know did wrong. thank in advance.

Is there a way to reverse a tuple's order in Julia? -

is there shorthand way reverse tuples order in julia? e.g. given: x = (1,2)::tuple reversetuple(x) (2,1) reverse(x) should expect.

SQL optimization tips -

i beginner sql , have performance problems query. tips? query running on huge database... select z_screenshots.guid, z_screenshots.player_name, z_screenshots.server, z_screenshots.map, z_screenshots.created, z_screenshots.uploaded, z_screenshots.uploader_id, z_screenshots.filesize z_screenshots inner join ( select clients.guid clients clients.id not in ( select clients.id clients inner join ( select client_id penalties penalties.inactive = 0 and(penalties.type = 'ban' or (penalties.type = 'tempban' , from_unixtime(penalties.time_expire) > now()) ) group penalties.client_id ) penalties o

python - Route testing with Tornado -

i'm new tornado, , working on project involves rather complex routing. in of other frameworks i've used i've been able isolate routing testing, without spinning server or doing terribly complex. i'd prefer use pytest testing framework, i'm not sure matters. is there way to, say, create project's instance of tornado.web.application , , pass arbitrary paths , assert requesthandler invoked based on path? no, not possible test in tornado via public interface (as of tornado version 4.3). it's straightforward avoid spinning server, although requires nontrivial amount of code: interface between httpserver , application well-defined , documented. trickier part other side: there no supported way determine handler invoked before handler is invoked. i recommend testing routing via end-to-end tests reason. store url route list before passing tornado, , tests against - internal logic of "take first regex match" pretty easy replicate.