Posts

Showing posts from April, 2010

c++ - Assigning values to enum -

while doing review of older code, notice following 2 strange constructions using enum (two different files/classes/namespaces, putting them here): enum firstenum { a_choice ,another_choice=1 ,yet_some_other_choice }; enum secondenum { first_choice ,second_choice ,third_choice ,default_choice=second_choice }; i think both constructions wrong. the first 1 assigns value 1 of choices, not others, meaning things might go wrong if new choices added. in second case, end 2 enumeration elements having same underlying value. is there reason why c++ standard allows both constructions? (using visual studio 2010) the first 1 assigns value 1 of choices, not others, meaning things might go wrong if new choices added. i don't know mean "go wrong". it's well-defined if don't specify value enumerator, value 1 more previous (or zero, if it's first). in second case, end 2 enumeration elements having same unde...

mocking - How to unit test Pop3 Client based on OpenPop.Net -

i know if there's fake (mock) mail server let feed our emails (as text or file) , receive them using our application uses openpop.net. our problem there mails (received various mail servers) have attachments when receive them using our application says don't have attachments.i able test our mail client changing email header. baby pop3 server looks may suitable needs. description website: in past have done several projects related e-mail (pop3/smtp/imap4). 1 of problems (at least in company) there never test servers available. that's why decided create simple pop3 server, doesn’t take many resources , supports of standard pop3 commands. in configuration description can used microsoft's smtp server (which included windows), using smtp server's mail drop folder input folder pop3 server. this means can email smtp server test emails pop3 server, in theory copy test emails directly folder.

eclipse - Exporting dynamic java web application to PDF? -

i completing application using zk framework runs under tomcat 7.0. custom calculator provides end users total costs of items based on input amount. could please recommend me best solution export contents pdf? possible? user need store values in pdf format on machine. speaking need export contents on screen pdf format , download onto users machine. thank you have nice day zk provide integration jasper report ,so here can use jasper report integration zk. question here how can there plenty of way . here can check create_a_report_with_zk_using_ireport_and_jasperreports integrate-zk-with-jasper-report integrate-dyanmic-jasper-reprot-with-zk note:- example done zk ee.

listview to open new page loading xml into new listview with links to sub page in jquery mobile -

i total noob jquery , asking in best way code list displays collection of buttons point lists created xml , lead display page when clicked. the idea come onto page, pick area of interest (listview), loads xml , displays areas list of content (listview). click on list item , takes content page text, video etc displayed. have 20 feeds have deal with. i can 1 xml feed work have had hard time understanding how deal multiple xml feeds , how call them , display them. examples helpful , appreciated. here have <!doctype html> <html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <title></title> <link rel="stylesheet" href="js/jquery.mobile-1.1.0.min.css" /> <script src="js/jquery-1.8.0.min.js"></script> <script src="js/jquery.mobile-1.1.0.min.js"></script> <script src=...

java - Libgdx Box2D Velocity is just not fast enough -

i have rectangle move fast ever reason faster velocity use still seems slow. doing wrong? have dropped circle above onto surface , tough play gravity comes down ballon... some declarations float velocity = 10000000f; static final float box_step=1/60f; static final int box_velocity_iterations=6; static final int box_position_iterations=2; gravity, tried , seem suck world = new world(new vector2(0, -50), true); the ground object moving onto //ground bodydef groundbodydef =new bodydef(); groundbodydef.position.set(new vector2(0, camera.viewportheight * .08f)); body groundbody = world.createbody(groundbodydef); polygonshape groundbox = new polygonshape(); groundbox.setasbox((camera.viewportwidth) * 2, camera.viewportheight * .08f); groundbody.createfixture(groundbox, 0.0f); and here objects: //ball bodydef = new bodydef(); bodydef.type = bodytype.dynamicbody; bodydef.position.set(new vector2(camera.viewp...

Hibernate Criteria join query one to many -

i have cat class , owner class. cat has 1 owner owner can have many cats. want query "get owners has cat blue eyes". class cat{ owner owner; //referenced owner.id string eyecolor; } class owner{ list<cat> catlist; } i tried codes don't know do. criteria criteria = getcurrentsession().createcriteria(cat.getclass(), "cat"); criteria.createalias("cat.owner", "owner"); criteria.add(restrictions.eq("cat.eyecolor", "blue"); criteria can select projections, or root entity. not joined entity. queries impossible express criteria (which 1 more reason use hql, in addition better readability , conciseness). all not lost here, though, because association bidirectional. need equivalent of hql query select distinct owner owner owner join owner.cats cat cat.eyecolor = 'blue' which is criteria c = session.createcriteria(owner.class, "owner"); c.createalias("owner.cats", ...

iphone web app - iOS External Accessory Framework from web app -

i'm being called upon build web app interfaces iphone accessory. see native apps use externalaccessory.framework access accessory, far i'm seeing no indication framework in way exposed web apps. possible (and if so, entry point), or need build native? what you're going have use native app layer of communication between ios accessory , web server. in other words you're going have intercept of responses web server , translate accessory via native objective-c. if write native app viewcontroller uiwebviewcontroller , either have web server bake in command payloads in response messages or gruelingly parse html embedded commands can pull off. company uses 3rd party accessory in manner , while it's not pretty works. mean "not pretty" in sense commands static per app build , underlying handling of accessory. luck! quick edit: depending on how re-usable want make interfacing accessory create framework commands baked in. way when need alter or expa...

SAS: Custom ODS LATEX tagset -

i'm trying customize output sas tagsets.latex, tagsets.simplelatex , tagsets.tablesonlylatex tagsets. have want: data rows, no headers, no other tags @ all. this output i'm getting: \tabularnewline \tabularnewline internet & 1 & 1 & 150.00 & 150.00 & . & 150.00 & 150.00 \tabularnewline mobile & 1 & 1 & 200.00 & 200.00 & . & 200.00 & 200.00 \tabularnewline phone & 1 & 1 & 100.00 & 100.00 & . & 100.00 & 100.00 \tabularnewline this output want: internet & 1 & 1 & 150.00 & 150.00 & . & 150.00 & 150.00 \tabularnewline mobile & 1 & 1 & 200.00 & 200.00 & . & 200.00 & 200.00 \tabularnewline phone & 1 & 1 & 100.00 & 100.00 & . & 100.00 & 100.00 \tabularnewline this how cre...

proxy - Bypassing HTTP basic auth locally -

i have 2 applications cannot change: a: provides url protected http basic auth. b: needs access url not support basic auth. credentials available. how can make 2 applications work together? i thought local proxy might great injects authentication. e.g. using socat: socat tcp4-listen:81,reuseaddr,fork tcp:urltoa:80,<inject-basic-auth>=user:pass however, socat not provide option < inject-basic-auth >. knows tool might help? other way out? you must set http reverse proxy server authentication you. no need hack software. your reverse proxy listens on socket (e.g. proxy:8080) , forwards requests actual application a, inserting headers. client_b ----> http://proxy:8080 -----> http://server_a:80 nginx lightweight, high performance , easy set up. , it's easy find docs online want. see example http://wiki.apache.org/couchdb/nginx_as_a_reverse_proxy

php - correct mysql syntax for a column not equaling either of two values -

i have table 'cars' column colour. i'm trying build query show cars have 4 doors, exclude cars have 'red' or 'black' recorded in colour column. select * 'cars' 'cars.doors = 4' , 'cars.colour != red or black' this doesn't seem work, i'm not sure if because i've got wrong whether there's else in code messing up. ok way? thanks you're enclosing conditions in single quotes invalid. should enclose strings in quotes. not red or black part can use not in() select * `cars` cars.doors = 4 , cars.colour not in('red', 'black') alternatively can long way, note use of and not or because or wouldn't appropriate want. and cars.colour != 'red' , cars.colour != 'black'

c++ - Pointer to template method gives <unresolved overloaded function type>) -

i've read numerous questions of similar problems, of time boil down people using function pointers instead of method pointers, or omitting class scope when creating pointer instance. i'm doing neither of (i think...): class test { public: test() { mfuncptrs.insert( 10, &test::func<int> ); } // error! template <class t> void func() {} private: typedef void ( test::*funcptr )(); std::map<int, funcptr> mfuncptrs; }; but gives: error: no matching function call ‘std::map<int, void (test::*)(), std::less<int>, std::allocator<std::pair<const int, void (test::*)()> > >::insert(int, <unresolved overloaded function type>)’ but i'm being explicit template type, providing full scope of method, , func() has no overloads! if makes difference i'm using g++ v4.1.2. you using insert() function of std::map wrongly. there no overload of insert() takes key , value 2 separate arguments. in...

javascript - FancyBox inline popup hiding background -

i have button shows inline fancybox popup: <a class="fancybox" href="#inlinesearchpopup"> <asp:button id="searchbutton" runat="server" text="search stories" onclick="searchbutton_click" /> </a> <div id="inlinesearchpopup" style="width: 400px; display: none;"> <h3> etiam quis mi eu elit</h3> <p> lorem ipsum dolor sit amet, consectetur adipiscing elit. etiam quis mi eu elit tempor facilisis id et neque. nulla sit amet sem sapien. vestibulum imperdiet porta ante ac ornare. nulla et lorem eu nibh adipiscing ultricies nec @ lacus. cras laoreet ultricies sem, @ blandit mi eleifend aliquam. nunc enim ipsum, vehicula non pretium varius, cursus ac tortor. vivamus fringilla congue laoreet. quisque ultrices sodales orci, quis rhonc...

ruby on rails - Limit total messages displayed in the inbox -

i can't seem find correct way set maximum number of messages display in users inbox without disfiguring pagination. i'm trying make last 100 inbox messages displayed newest oldest. messages_controller.rb class messagescontroller < applicationcontroller def index @messages = current_user.received_messages.paginate(:page => params[:page], :per_page => 15, :order => 'created_at desc', ) end using will_paginate gem <%= will_paginate @messages %> def index @messages = current_user.received_messages.paginate(:page => params[:page], :per_page => 15).order('created_at desc').limit(100) end or try with def index @records = current_user.received_messages.order('created_at desc').limit(100) @messages = @records.paginate(:page => params[:page], :per_page => 15) end hope work

How to use Sqlite for Xamarin.Android -

i new sqlite. understand far. please confirm understanding. 1) sqlite engine built android-os system so, dont need download , install sqlite engine website. now, have these questions : 2) if include sqlite database( data in it) in project, need read ( use memorystream read buffer, based on wp on slqce ) folder or directory under sqlite engine? 3) there tutorial on create table, add, insert, update sqlite, setup relationship 4) referential integrity supported? if delete primary key , foreign key deleted well. thanks one application has helped me in building sqlite databases this sqlite expert, http://www.sqliteexpert.com/ standalone piece of sofware gui can design databases , produce sql code produce database. the thing setting database need create class android.database.sqlite.sqliteopenhelper object , override oncreate(sqlitedatabase db) , onupgrade(sqlitedatabase db, int oldversion, int newversion) methods. write insert methods , forth. good luck,...

symfony - Symfony2: Something like a Role Provider? -

in web application, want user's able create roles , add users them dynamically. thing imagine, edit security.yml every time, can't best solution, can it? nice, if there user provider roles, can define 1 loads roles database (doctrine). thanks help, hice3000. then, should want add role entity model hice. you have know symfony2 provides support dynamic roles too. have getroles() method in symfony2 user spec in api doc , user entity should implement, forces him return roles. these roles must either implement role interface specifies getrole() method returns, usually, role name itself. you can add newly created role directly user role list getroles() user method return. here example using annotations : first role class /** * role class * * @orm\entity() */ class role implements roleinterface, \serializable { /** * @var integer * * @orm\column(name="id", type="integer") * @orm\id * @orm\generatedvalue(st...

entity framework - MVC4 EditorForModel template for EntityFramework -

in mvc4 web application using razor engine , entity framework, possible create template use html helper @html.editorformodel , entities links other tables better displayed. the example working dbcontext containing 2 dbsets, regions , schools. there many regions, , school may belong 1 region. ideally editor schools show dropdown of regions select from. make template generic enough can call @html.editorformodel helper , form generated in 1 go, , make changes region or schools tables later on , changes reflected in edit form without me needing make alterations. some code: public class mycontext : dbcontext { public mycontext () : base("defaultconnection") { } public dbset<region> regions { get; set; } public dbset<school> schools { get; set; } [table("regions")] public class region { public region() { schools = new list<school>(); } [key] public in...

javascript - Issue with stock Browser picking photos from Gallery -

Image
i working on web page uploading photos mobile device, using <input type="file" accept="image/*"/> tag. works beautifully on iphone , on chrome on android, running issues stock android browser. the issue arises when select file gallery (it works fine when use camera take photo). , have narrowed down further seeing data mime type isn't available when taken gallery on stock browser (the photos below show first 100 characters of data url being loaded. goal force jpeg, without mime type cannot know sure how fix this. see code below how images being rendered. how can image rendered without type? better yet, know why type not available on stock android browser? edit firstly, these not same image, taken near same time, , that's not issue, that's why data different (the mime type doesn't appear on images on stock browser, that's not problem. update i confirmed mime type issue inserting image/jpeg stock browser on chrome. unfortuna...

eBay Listing Special HTML Tags -

Image
i'm looking customise our ebay listings html. i'd link of our own ebay categories, ebay custom pages, , our ebay store front. obviously can create standard html anchor, need drop in ebay custom tags if have them. need: our shop url our category url our custom pages url we have on 8,000 listings, , if change name of our store, or name of category (or if ebay change url structure), don't want have update 8,000 again because html links wrong. need like: <a href="{categoryurl id=123}">category</a> ...and... <a href="{storeurl}">store home</a> this way, if name changes url's too. i have found these pages: http://pages.ebay.com.sg/help/account/html-tags.html http://pages.ebay.co.uk/help/specialtysites/stores-specific-tags.html ...but don't include url's. is possible..?? it possible using html builder:

Python ctypes segmentation fault when rootfs is read-only and /tmp is noexec -

i'm trying use python embedded app on arm processor running linux (cpython 2.7.3 cross-compiled x86/linux). worked until started securing device prevent tampering. first made rootfs read-only, both prevent corruption of rootfs on sudden loss of power , prevent modification our main code unauthorized users. still, python , our ctypes libraries continued working normal. /tmp directory gets mapped tmpfs (ramdrive). step of hardening set noexec flag on tmpfs partition prevent users somehow uploading code lead local root exploit. both of options set, importing ctypes produces immediate segfault: root@atx4:~# python python 2.7.3 (default, jul 16 2013, 17:15:57) [gcc 4.3.3] on linux2 type "help", "copyright", "credits" or "license" more information. >>> import ctypes segmentation fault interestingly enough, of changes below allows ctypes work correctly: remounting rootfs read-write remounting tm...

install - python installing pywinauto on 64 bit -

i trying install pywinauto on 64 bit machine. have dealt issues assertion error , removed them win32structures file. when go import pywinauto error: >>> import pywinauto traceback (most recent call last): file "<stdin>", line 1, in <module> file "c:\python27\lib\site-packages\pywinauto\__init__.py", line 28, in <module> import findwindows file "c:\python27\lib\site-packages\pywinauto\findwindows.py", line 37, in <module> import controls file "c:\python27\lib\site-packages\pywinauto\controls\__init__.py", line 25, in <module> hwndwrapper import getdialogpropsfromhandle file "c:\python27\lib\site-packages\pywinauto\controls\hwndwrapper.py", line 34, in <module> pywinauto import sendkeysctypes sendkeys importerror: cannot import name sendkeysctypes does know how solve problem? it known pywinauto problem. use chain - python(32bit) + pywinauto on 64bit system....

c++ - Eigen Library Speed Up Matrix Initialization -

is there way speed running time of following code? matrix<double, 10, dynamic> a(10,n); << a1, a2, a3, a4, a5, a6, a7, a8, a9, a10; here, n known @ runtime, , a1, a2, , on vectors of length n. i've tried approximate max size of matrix , use double, 10, dynamic, 0, 10, 10000 did not give increase in speed. if use rowmajor matrix a, copies faster better cache coherence , vectorization: matrix<double,10,dynamic,rowmajor> a(10,n); however, might slow down other operations. finally, make sure compiled optimizations on (e.g., -o2 gcc), , might faster avoid comma initializer syntax with: a.row(i) = a_i; (not sure because depends on compiler, that's worth trying if copy bottleneck)

asp.net mvc - Refactor Control Pattern in View -

the following code snippet represents items in large form. objective refactor down. <div class="span3"> <ul style="list-style-type: none"> <li><b>description</b></li> <li> <textarea style="width: 100%;" rows="4">@model.item.description</textarea> </li> </ul> </div> <div class="span3"> <ul style="list-style-type: none"> <li><b>truck</b></li> <li> @html.dropdownlistfor(model => model.item.shippingtruckid, new selectlist(model.shippingtrucks, "id", "truck")) </li> </ul> </div> <div class="span3"> <ul style="list-style-type: none"> <li><b>cost</b></li> <li> <input value="@model.item.cost"/> </li> </ul> </div> two appr...

algorithm - Search a string as you type the character -

i have contacts stored in mobile. lets contacts are ram hello hi feat eat @ when type letter 'a' should matching contacts "ram, feat, eat, at" . now type 1 more letter t . total string "at" program should reuse results of previous search "a" . should return me "feat, eat, at" design , develop program this. this interview question @ samsung mobile development i tried solving trie data structures . not solution reusing searched string results. tried solution dictionary data structure, solution has same disadvantage trie . question how search contacts each letter typed reusing search results of earlier searched string? data structure , algorithm should used efficiently solving problem. i not asking program. programming language immaterial me. state machine appears solution. have suggestion? solution should fast enough million contacts. it kind of depends on how many items you're searching. if it...

request - Apostrophe in Textarea PHP -

i have textarea part of form submits php file. the problem when apostrophe (’) entered textarea, corresponding request variable in php turns empty ($_request['description']). if there no apostrophe, $_request['description'] contains textarea text intended. entering punctuation single quotes , double quotes works apostrophe not. same problem occurs <input type="text"></input> well. there way fix that? do have magic quote in php config ? try disable it.

qpixmap - Save byte array as .png/.jpg file in QT -

this have far: qfile file(filename); file.open(qiodevice::writeonly); qpixmap pixmap = qpixmap.loadfromdata((const uchar *) imagebuffer_pointer, (sizeof(imagerows) * sizeof(imagecols)); pixmap.save(&file, "jpg"); pixmap.save(&file, "png"); but produces 0 byte image files it easier give save() function file name first parameter: qpixmap pixmap = qpixmap.loadfromdata((const uchar *) imagebuffer_pointer, (sizeof(imagerows) * sizeof(imagecols)); pixmap.save(filename, "jpg");

Python: Printing unicode characters beyond FFFF -

on python 3 printing unicode characters can printed this: print('\uffff') but how can print higher unicode characters 001fffff? print('\u001fffff') print 001f unicode character , 4 times f. trying use print('\u001f\uffff') result in 2 unicode characters instead of wanted one. possible print somehow unicode character 001fffff in python 3? use upper-case u. print('\u001fffff')

javascript - Html on before print -

i have page couple of ads pop , has form on it. want use onbeforeprint detect , remove ads, form submit , reset buttons , replace textboxes strings. after user closes print dialog (i not care if canceling or clicking print) ads come , form remade. you can hide them using following css... @media print { input, .ads-class { display:none } } obviously edit selector suit needs. way don't need worry adding things after printing.

ios - Mobile Jquery slider is not showing properly -

Image
i developing ios app using phonegap. have used following code implementing slider in app <form> <label for="slider">product quality:</label> <input type="number" data-type="range" name="slider" id="slider-1" value="0" min="0" max="100"/> </form> but not displaying slider properly. please me!! this happen if use incompatible versions of jquery mobile js file , css file. example 1.3.1 js , 1.2.1 css file. proof: http://jsfiddle.net/gajotres/pmrdn/31/ make sure using correct jquery mobile files: <link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.1/jquery.mobile-1.3.1.min.css" /> <script src="http://code.jquery.com/mobile/1.3.1/jquery.mobile-1.3.1.min.js"></script>

Why does git merge with no conflicts still produce a merge commit? -

i'm trying understand why git produce commit unique sha1 merge between 2 branches no conflicts. storing information there no conflicts worth clutter revision history? the short answer commit records specific state of working directory, , merge create state doesn't match either of parents, new commit required, opposed moving branch pointer. elaborate bit more, though, helps understand means merge 2 branches. the 2 common ways git merge used a) catch local branch remote branch , b) merge 2 separate branches together. in first case, have this: a--b--c--d--e--f--g ^ ^ | +-- origin/master +-- master in case, git merge origin/master moves pointer master new location. what's called "fast forward" merge, , not result in new commit (although can explicitly request 1 if have reason to). on other hand, if have this: a--b--c--d--e--f--g <-- branch1 \ j--k--l--m--n <-- branch2 and on branch2...

authentication - Varnish and ESI HTTP AUTH -

i'm lost on problem, , don't know problem, so, hope me. i have http basic authentification symfony, , i'm trying reach url protected auth, tag in drupal page. every requests send varnish i give username , password in url : <esi:include src="http://admin:adminpass@api.dev:8081/app.php/next"/> in varnish configuration file, have lines auth.http: if (req.http.authorization) { return (pass); } my backend symfony working without http authentification, , http authentification working when there's not varnish , esi tag. if have idea of problem, please, tell me, if it's wrong =) esi in varnish doesn't work iframe or link tag in browser in doesn't connect whatever url give it. esi starts new request within varnish , goes through workflow (vcl_recv, etc). you expecting varnish act http client, parsing url, setting authorization header, setting host header api.dev:8081 , initiating new http connection/request not. in case...

CKEditor jQuery Value is Empty -

ckeditor jquery value ? var val = jquery('.ckeditor').val(); or var val = jquery('textarea[name="content"]').val(); problem : value empty; ckeditor version 4.x; help me if have instantiated ckeditor recommended tutorials, example: editor = ckeditor.appendto("editorcontainer", config, ""); then may content following call: editor.getdata();

Awk parsing a math equation into variables -

well, i'm new awk , have input equation this: y = 0.02 sin(20Ï€t-0.2Ï€x) from equation,i want to: -copy 0,02 variable -copy sin b variable -copy 20 20Ï€t c variable -copy -0.2 -0.2Ï€x d variable -and rid of whitespace but don't know how in awk, can me please? in advance you can start doing following , work way cover edge cases. please note solution extremely fragile , not work if input changes. consider guide towards more concrete solution based on input data $ echo 'y = 0.02 sin(20pt-0.2px)' | awk -f'=' '{split ($2,ary,"[ (t]"); print "a="ary[2]; print "b="ary[3]; print "c="ary[4]+0; print "d="ary[5]+0}' a=0.02 b=sin c=20 d=-0.2

exit temporary modified file without saving and jump back to my previous viewing place in vim -

this question has answer here: unsaved buffer warning when switching files/buffers 2 answers in vim , viewing file, , opened temporary file , did modification, want original file. typed ctrl-o , got e37: no write since last change (add ! override) how can exit temporary modified file without saving , jump previous viewing place? by turning on 'hidden' can jump between unsaved buffers without e37 error messages. don't worry vim stop exiting without saving changes unless use :q! . set hidden see :h 'hidden' more information.

Binding RET to newline in Emacs -

in emacs, while major mode ess[s] (emacs speaks statistics) in effect, ret automatically bound newline-and-ident prefer bound newline . following advice here , bound ret newline . works editing while in ess, has undesired effect of affecting commands in mini-buffer. cannot use ret finish commands in mini-buffer; instead, inserts new line mini-buffer rather executing command. is there way bind key in minor mode, have not affect mini-buffer whatsoever? even turning minor-mode off doesn't seem work , cumbersome switch minor mode on , off if did. this relevant part of .emacs file: (defvar my-keys-minor-mode-map (make-keymap) "my-keys-minor-mode keymap.") (define-key my-keys-minor-mode-map (kbd "ret") 'newline) (define-minor-mode my-keys-minor-mode "a minor mode key settings override annoying major modes." t " my-keys" 'my-keys-minor-mode-map) (my-keys-minor-mode 1) you have answer in question: (define-key...

google maps api 3 - Info Window Shadow very abnormal in IE8 when zoom is set as 125 -

the info window in google maps api v3 looks abnormal , dark when zoom set 125.is there fix this? this issue in ie8. the issue on google maps api v3 marked "wontfix".

android - How to put a link in a Google map marker's snippet -

i'm trying link website , (hopefully) phone number snippet of map marker creating on map. there anyway this? if not, way possibly display above clicked marker contains clickable website , clickable phone number. thinking alert dialog not know how set onclicklisteners dynamically made map markers. public void addwaypointmarkers(latlng point){ markeroptions marker = new markeroptions(); marker.title(name); marker.snippet(html.fromhtml(address + "<br />" + phone + "<br />" + "<a href=\"" + website + "\">website</a>")); marker.position(point); map.addmarker(marker); } if want link clickable, not work the info window drawn not live view. view rendered image (using view.draw(canvas)) @ time returned. means subsequent changes view not reflected info window on map. update info window later (e.g., after image has loaded), call showinfowindow(). furthermore, info window not...

mysql - Data_length in 'show table status' -

i trying find out size of database table. ran 'show table status' query, , have data_length parameter in result. represent actual size of database table? for innodb, data_length estimate of table size, in bytes, not counting secondary indexes. documentation says "size of data file" language assumes have data in separate file, isn't case innodb. the size of table bit fuzzy innodb, because innodb stores copies of rows globally in rollback segment, , there other uses of on-disk storage (data dictionary, change buffer). you should add index_length , size of secondary indexes.

socket.io - Node.js and global MySQL connection OBJ -

i'm beginner node.js, ever ok use mysql global var? i have db_helper.js code inside: global.client = require('mysql').createconnection({ user: '__mysqluser__', password: '__mysqlpass__', database: '__mysqldb__', timezone: '-03:00' }); global.client.connect(); on main.js a: require('db_helper'); then on other js files, whenever need update or select call: global.client(query, data); i haven't seen code yet, works expected, i'm experiencing random crashes time time, when reloading pages. is ok use this? crashes related way connect db? i think it's related because when crash happens, because mysql fails return data, crash happens when parsing result, like: global.client.query(query, function(err, results, fields) { if (err) throw err; if (results && object.prototype.tostring.call(results) === '[object array]') { var j = result[0].data; } } most of time,...

Python conciseness confuses me -

i have been looking @ pandas: run length of nan holes , , code fragment comments in particular: series([len(list(g)) k, g in groupby(a.isnull()) if k]) as python newbie, impressed conciseness not sure how read this. short along lines of mylist = [] k, g in groupby(a.isnull()) : if k: mylist.append(len(list(g))) series(mylist) in order understand going on trying play around error: list object not callable so not luck there. it lovely if shed light on this. thanks, anne you've got translation correct. however, code give cannot run because a free variable. my guess getting error because have assigned list object name list . don't that, because list global name type of list. also, in future please provide full stack trace, not 1 part of it. please provide sufficient code at least there no free variables.

jQuery select ul li items with next prev buttons -

i'm trying select li element prev next buttons, using code: http://jsfiddle.net/kzyay/41/ if keep clicking next/prev keeps going out of ul element. idea how select inside ul ? thanks! here fiddle: http://jsfiddle.net/kzyay/41/ <ul class='selected' id=""> <li id="">1</li> <li id="">2</li> <li id="">3</li> </ul> <div>current tag:<span id="current-tag"></span></div> <button id="prev">previous</button> <button id="next">next</button> js: (function($) { $.fn.domnext = function() { return .children(":eq(0)") .add(this.next()) .add(this.parents().filter(function() { return $(this).next().length > 0; }).next()).first(); }; $.fn.domprevious = function() { return .prev().find("*:...

python - How to create an argument that is optional? -

instead of user having use script.py --file c:/stuff/file.txt there way let user optionally use --file ? instead, script.py c:/stuff/file.txt parser still know user referring --file argument (because it's implied). try this import argparse class donotreplaceaction(argparse.action): def __call__(self, parser, namespace, values, option_string=none): if not getattr(namespace, self.dest): setattr(namespace, self.dest, values) parser = argparse.argumentparser(description="this example.") parser.add_argument('file', nargs='?', default='', help='specifies file.', action=donotreplaceaction) parser.add_argument('--file', help='specifies file.') args = parser.parse_args() # check file argument if not args.file: raise exception('missing "file" argument') look @ message. arguments optional usage: test.py [-h] [--file file] [file] example. positional arguments: fil...

jquery - Reload previously unloaded content ajax -

not sure how begin thinking solving issue. many searches loading , unloading ajax return results how unload before loading new stuff, not reload unloaded content. i have web app loads content target div, contains links unload first loaded content , load in new content same target div. create script change href reload content unloaded. to put perspective, building portfolio loads portfolio full of project thumbs index. clicking on project thumb unload thumbs , load project details. button link load portfolio thumbs , there, clicking again link main index. the structure this: /index.php /portfolio/index.php (list of thumbnails linking each project) /portfolio/project.php (gathers relevant information project) i need button that: isn't shown when @ state 1 links index @ state 2 , links portfolio @ state 3. for moment, have partially works, relies on me typing in specific pages check. i'd dynamically changes. //if link containes project.php, show button, if n...

Google Glass Timeline item actions: What are the icon dimensions? -

what native image dimensions of icons specified in 'iconurl' custom timeline item action? this doesn't appear documented yet. the menuitems's icon should 50 x 50 pixels , white on transparent according our documentation on ui guidelines : follow these guidelines when designing menus: if specify icon, use 50x50 pixel image. limit display names few words if possible. use default icon , display name built-in menu items unless using menu item different.

ios - ActionSheet displaying well below view -

i attempting have actionsheet contains pickerview display @ bottom of screen across multiple devices (iphone4/5 namely). assume make display flush @ bottom of screen, want y origin of actionsheet @ height of view (push way bottom) minus height of actionsheet (to move on y axis). this showing actionsheet below bottom of screen. code: [actionsheet setframe:cgrectmake(0, self.view.frame.size.height - 294, 320, 294)]; nslog(@"%f %f %f %f", self.view.frame.origin.x,self.view.frame.origin.y, self.view.frame.size.width,self.view.frame.size.height); nslog spitting out: `0.000000 0.000000 320.000000 372.000000 so 372-294 actionsheet 78, gives? logic flawed. which view passing in when call showinview:(uiview*)view sounds may passing in wrong view , offsetting position incorrectly. to add on this, shouldn't have deal uiactionsheet's frame. should position accordingly you. [_myactionsheet showinview:[[[uiapplication sharedapplication] ...

php - ZIP all files in directory and download .zip generated -

well, first of all, folder structure: images/ image1.png image11.png image111.png image223.png generate_zip.php and mine generate_zip.php: <?php $files = array($listfiles); $zipname = 'adcs.zip'; $zip = new ziparchive; $zip->open($zipname, ziparchive::create); foreach ($files $file) { $zip->addfile($file); } $zip->close(); header('content-type: application/zip'); header("content-disposition: attachment; filename='adcs.zip'"); header('content-length: ' . filesize($zipname)); header("location: adcs.zip"); ?> how gather files "images/" folder, except "generate_zip.php", , make downloadable .zip? in case "images/" folder have different image. possible? this ensure file .php extension not added: foreach ($files $file) { if(!strstr($file,'.php')) $zip->addfile($file); } edit: here's f...

c++ - Usefulness of RAII without exceptions -

i found raii in c++ , examples of raii talk exception safety. how can release resources if exception thrown. the question have is, if raii worth if not have exceptions turned on. in our firm work on embedded projects arm , exceptions turned off default , don't see need them. thanks answers! raii exceptions requirement. raii without exceptions means can couple allocation of resources code dispose resources. this lets have functions multiple exit points, simplifies writing of destructors (often destructors in raii heavy environment empty or default), can simplify object assignment , moving (once again, empty or default sufficient raii work). a classic example embedded environments locking , unlocking mutex. want guarantee don't lock mutex , forget unlock it. this, code discipline means have have 1 exit point function, , have engage in gymnastics ensure happens. with raii, create raii resource holder owns lock. can return whenever want, , code unlock re...

php - cURL can't connect through working proxies? -

i have script tests compiled list of http proxies see if can connect specified website. if connect, , correct page results returned, added list of working proxies; however, if test 30,000 proxies @ time....none of them come working. yet, when check random selection of them in proxy checker, quite large portion of them come working. http://puu.sh/3ejdo.png (picture of connection results) even when specify proxy type http, curl never manages make connection webpage , return webpage contents. note: setting user-agent. as can see, no results returned. contents of webpage, if retrieved, should posted in textbox. http://puu.sh/3ek4z.png don't think help, here's curl request setup: foreach($proxies $proxy){ $proxy_split = explode(':',$proxy); if(!in_array($proxy_split[1], $this->banned_ports)){ $checked[] = $proxy; $this->curl->addsession('http://www.removed.com', array( curlopt_pro...

node.js - express, authentication without 401 -

this resume authentication method. tried use express.basicauth , forces browser ask user , pass, , need use own login page, google, facebook yahoo... is right? there better way this? want avoid modules, passport, if can. i want use function this, using auth middleware (app.get('/loggedin', auth, function(req, res)...) var express = require('express'); var app = express(); app.use(express.cookieparser()); var redisstore = require('connect-redis')(express); app.use(express.session({ store: new redisstore({ host: 'localhost', port: 6379, db: 2, pass: 'redispass' }), secret: '1234567890qwerty' })); var auth = function(req, res, next) { if (req.session.authstatus === 'loggedin') next(); else res.redirect('/login'); }; app.get('/', function(req, res) { console.log("/"); res.send('not authenticate'); }); app.get('/signin'...

ajax - XML file content display on HTML page -

i have xml url , want display content url html page. here code trying make happend. <head> <script src="http://code.jquery.com/jquery-1.8.2.min.js"></script> <script type="text/javascript"> $(document).ready(function () { // load xml file using jquery ajax $.ajax({ type: "get", url: "http://courseleaf.ua.edu/introduction/academicpolicies/departmentprogramcoursealphasymbols/index.xml", datatype: "xml", success: function (req) { if($(req).find("text").length) { var course = $(req).find("text").text(); } else { var course = "<p>course information cannot found. </p>"; ...

date - Why is java.sql.Time object giving different times one year apart? -

i'm bit confused how java.sql.time object calculates time. i'm trying setup timer @ time everyday. however, when calculating time, place alarm, seem placing alarm 1 hour ahead of should be. this starts happening 494 days ago though (current date 7/17/13). occurs if go farther (such 1000 days ago), , i'm guessing cycles through +1 hour , +0 hours every couple hundred of days. i subtract hour input time, understand why happening. private static long onedayinmill = timetomill(24, 0); private static long remindertime = timetomill(13 + 6, 25); //military time; starts @ 18, not 0 reason private static long currenttimeinmill = system.currenttimemillis() % onedayinmill; private static long currentdayinmill = system.currenttimemillis() - currenttimeinmill; system.out.println(new time(currentdayinmill - (onedayinmill*495)+ remindertime).tostring()); // displays 13:25:00 (as expect) system.out.println(new time(currentdayinmill - (onedayinmill*494)+ remindertime)...

php - Get facebook posts for specific date -

i have : $config = array(); $config['appid'] = ''; $config['secret'] = ''; $config['fileupload'] = false; // optional $facebook = new facebook($config); $pageid = ""; // can access various parts of graph, starting feed $pagefeed = $facebook->api("/" . $pageid . "/feed"); i want posts specific date don't know how this. if can me great. you can use time-based pagination. can read more here (read time-based pagination). there nice how-to paging graph api , fql can used reference. here simple call pages through posts on chick-fil-a page: https://graph.facebook.com/chickfila/posts?limit=5&since= {since}&until={until}access_token={access_token} where {since} unix timestamp or strtotime data value points start of range of time-based data. {until} unix timestamp or strtotime data value points end of range of time-based data. {access_token} users ac...

Including additional custom attributes in an laravel eloquent response -

model class profile extends eloquent { public function user(){ return $this->belongsto('user'); } public function url(){ return url::route('profile', array('city_slug' => $this->city_slug, 'slug'=> $this->slug)); } } controller class profilecontroller extends basecontroller { public function show($user_id) { $profile = profile::with('user')->where('user_id', $user_id); return response::json($profile, 200); } } i response include generated url profile method url(){} { "id" : 1, "url" : /profile/{city_slug}/{slug}, .... } thanks in advance. i go @ other way. in users model... public function profile() { return $this->belongsto('profiles','profile_id'); } then can use $profile = user::find(user_id)->profile . $data = array( 'id' => $profile->id, 'url...

webserver - Accessing BeagleBone from the Internet(not from browser) -

i wanted head start on how can control beaglebone black internet preferably have android app there on other part! i have gone through lot of tutorials access using browser , want access through android phone's app may tcp/ip app. so wanted know whether should use webserver or not if yes which? tornado, node.js , headstart on how step step

What is the best use of provided SQL Database table in Windows Azure Mobile Services? -

i have been experimenting windows azure mobile services. impressed creates table me , database connection along projects in various platforms. wish data windows azure storage however, because sql database can expensive. my thought is, since provided, makes sense use store account information. can use azure storage changing data. minimal information should necessary such use? here possible table design. unique_id: guid email_address : varchar oath_provider_choice : varchar oath_yahoo : varchar oath_google : varchar oath_microsoft : varchar does make sense or much? you can access azure table storage mobile services using azure module. have pretty extensive sample here ( http://chrisrisner.com/mobile-services-and-windows-azure-storage ) shows how insert / update / delete / read tables , rows mobile services table scripts (effectively bypassing using sql database). shows how can use blob storage. mobile services has custom api, might make more sense use opposed...

javascript - Excel file opened from IE doesn't exist, but does -

i have user who, when download excel file hosted on our intranet, receives error message telling them file doesn't exist. occurs in ie. i've verified file in fact exist, , can accessed other users same permissions in same geographic location. not interop issue - file being hosted. able reproduce issue once machine in ie 9 opening file @ open/save prompt, after excel asked me authentication credentials 3 times, gave me same error, opened file anyway. have since been unable reproduce it. computer "open file anyway." i stumped. have ideas? error message: microsoft office excel cannot access file . there several possible reasons: the file name or path not exist. the file being used program. the workbook trying save has same name open workbook. edit the user using ie 7. code serving file: <asp:linkbutton id="lbtnestimatingworkbook" runat="server" cssclass="brightness" tooltip="estimate calculation workbook...

jQuery: call another event then continue executing current event -

curious how execute original event after event. instance, proper way chain events? because don't have simple example, i'll try create one: jsfiddle $('#select').on( 'click', function(event) { $('#clearselectbutton').click(); // clears select list // still want select option // select list (continuing original event) });

javascript - Is there a way to attach a file to an HTML form without using the type="file" attribute of the <input> tag? -

say have html page form posting. form intended post file server, , end uses <input type="file" name="attachment" ...> tag attach file data. however, if want programmatically attach file data instead of manually browsing on local machine? say instance have raw file data in text format file , want attach form. i've tried things along lines of <input type="hidden" name="attachment" value=myrawfiledata ...> however when <input type="file"> submitted form there 2 attributes filename , content-type show in post, , when use method mentioned above attribute appears name="attachment" one. i'm assuming these specific whatever html file object being attached through type="file" attribute. there way attach hmtl "file object" without using type="file" , browsing on local machine?

angularjs - Angular set ng-minlength from controller does not work -

here controller: function ctrl($scope) { $scope.text = 'guest'; $scope.word = /^\w*$/; $scope.min_length = 4; } here view: <form name="myform" ng-controller="ctrl"> single word: <input type="text" name="input" ng-model="text" ng-pattern="word" ng-minlength="min_length" required /> ... </form> the ng-minlength="min_length" won't trigger minlength error except explicitly write ng-minlength="4" . however, ng-pattern="word" works fine. here jsfiddle link is because doing wrong or there way around? here how ng-minlength <input ng-minlength="{{ min_length }}" /> here working jsfiddle link

vba - Calculate Event: Insert Comment In Cell If Value and Delete Any Comments If Not Value -

the following code change event handler searches col b word "fee" , inserts comments in 3 adjacent cols if word "fee" found in col b: private sub worksheet_calculate() dim rng range, cell range set rng = range("b:b") if not rng nothing each cell in rng.cells if cell.value = "fee" cell.offset(0, 1).addcomment "fi" cell.offset(0, 2).addcomment "fo" cell.offset(0, 3).addcomment "fum" end if next end if end sub the above code works fine. i want search col b , delete existing comments in 3 adjacent cols if word "fee" not occur in col b. so, added else statement: private sub worksheet_calculate() dim rng range, cell range set rng = range("b:b") if not rng nothing each cell in rng.cells if cell.value = "fee" cell.offset(0, 1).addcomment "fi" cell.offset(0, 2).addcomment...