Posts

Showing posts from August, 2010

ruby on rails - How to generate a radio-inline label with simple_form and bootstrap? -

i'm using: <%= simple_form_for @visitor, html: {class: 'form-inline'} |f| %> <%= f.error_notification %> <%= f.input :favorite, label: false, as: :radio_buttons %> <%= f.submit "choose!", :class => "btn btn-primary"%> <% end %> and html: <div class="control-group radio_buttons required visitor_favourite"> <div class="controls"> <label class="radio"> <input class="radio_buttons required" id="visitor_favourite_true" name="visitor[favourite]" type="radio" value="true" /> yes </label> <label class="radio"> <input class="radio_buttons required" id="visitor_favourite_false" name="visitor[favourite]" type="radio" value="false" /> no </label>

django apps and models.py in 1.7 - what exactly has changed? -

django 1.7 has introduced apparently major changes how apps work https://docs.djangoproject.com/en/dev/releases/1.7/#app-loading-refactor these release notes seem saying can define models outside of models.py , don't need models.py (or models/__init__.py ) inside app. am misunderstanding this? if not, explain define our models if not in models.py , how django find , load them? you should still define models in models.py . before app refactor in 1.7 there wasn't unified api declaring metadata app. in particular, way django determined whether app or not looking models.py file. not elegant system, when consider apps don't have models (for example, app might provide management commands). now appconfig api exists it's no longer necessary require existence of models.py . however, it's still natural, , default, place define models. how django find , load them? from documentation : "you must define or import models in application’s model

windows xp sp3 - Framework installation got frozen -

i wanted install sp1 of microsoft framework 3.0 , @ 100% stucked. decided let go while. however, didnt help. info icon written: downloading ended. may disconnect internet. then hopeless clicked on - cancel - see (storno) , nothing till now. dont want close manually, want find easy solution. :( dont have enough reputation post images here link: http://s4.postimg.org/di4afrb25/bez_n_zvu.jpg

node.js - NodeJS : can not emit event "Object ...{} has no method 'emit' -

i followed few nodejs tutorials ang got through simple rest webservice. webservices listens /api/accounts email , password, proceeds lookup in cassandra cluster. use eventemitter avoid callback hell. works fine until emit('success') attempted : events.js:72 throw er; // unhandled 'error' event ^ typeerror: object select * accounts email_accounts=?,test@gmail.com,77ddcc8d868e1532f86f0e25f35d43e5,function _checkpassword(error, response) { var rows=response.rows; if (_checkforerrors(error, rows , 'password')) { return false; } else { if ( rows.length == 1 ) { console.log('got user profile password_accounts ' + rows[0].pwd_accounts); this.emit('success', rows[0] ); } } } has no method 'emit' @ array._checkpassword (/home/scoulibaly/node/login.js:33:10) @ /home/scoulibaly/node/node_modules/node-cassandra-c

asp.net - MVC conditional routing -

i have asp.net mvc website , subdirectory "/dir/" under configured asp.net application. i want http://website/dir/ url route parent controller if condition met, or ignore , "pass over" subdir-application if not. how do this? ps. cannot use routeexistingfiles = true because both apps have aspx/ashx/html files need work. you may use route constraints purpose.

How do I turn off Node.js Express (ejs template engine) errors for production? -

when i'm on development server , there error, express sends traceback response. however, not production. don't want seeing trackback. how can turn off? note: i'm using ejs template engine - may cause, , not express. when have undefined variable in ejs template, example, ejs renders traceback , displays user on white page. the latest version of express use smart default error handler. in development mode sends full stack trace browser, while in production mode sends 500 internal server error . to take advantage of should set proper node_env before running application. for example, run app in production mode: node_env=production node application.js but if don't default behavior, define own error handler: app.use(function(err, req, res, next){ console.error(err); res.status(500); res.render('error'); }); note error handler must last middleware in chain, should defined in bottom of application.js file. if need more i

c++ - Cocos2d-x 3.2 Error - Change Arrays to Vectors? -

i getting error following code because using arrays instead of vectors. best way write code using vectors? ccanimate* createanimate(int framecount, float duration, const char* imagename) { ccarray * spritesarray = ccarray::create(); (int = 0; < framecount; i++) { ccstring *spritepath = ccstring::createwithformat("%s%i.png",imagename,i); ccsprite *sprite = ccsprite::create(spritepath->getcstring()); spritesarray->addobject(sprite); } ccarray *animationframes = ccarray::create(); (int = 0; < spritesarray->count(); i++) { ccsprite *sprite = (ccsprite*)spritesarray->objectatindex(i); ccspriteframe *frame = sprite->displayframe(); animationframes->addobject(frame); } ccanimation* animation = ccanimation::createwithspriteframes(animationframes,duration); ccanimate* animate= ccanimate::create(animation); return animate; } vector<spriteframe*> villanspriteframes(f

c# - Comparing GUID to string in LINQ to Entites throws error -

this question has answer here: operator '==' cannot applied operands of type 'system.guid' , 'string' in linq entity 7 answers edit, not duplicate. suggested links want me call tostring() running .count() , trying greater comparison calling tostring() not correct answer. i trying fill variable using if shortcut when run error linq entities not recognize method 'system.guid parse(system.string)' method, , method cannot translated store expression. the code running is isadmin = (db.yaf_prov_rolemembership .where(rm => rm.userid == userkey && rm.roleid == guid.parse("adsfasd654asdf816asdf")) .count() > 0) ? true : false; if take away guid.parse , straight comparison error operator == cannot applied operands of type system.guid , string w

javascript - TouchSwipe - multiple events on one swipe -

i'm using touchswipe jquery plugin mobile version of site. need fire multiple click-events on 1 swipe, - on every 15px of swipe - 1 click. i've googled, found no solution. thing - i'm using carousel plugin joomla (sigplus), that, unfortunately, doesn't support finger swipe. i'm trying emulate swiping function making touchswipe pressing carousel buttons user on swipe. @ moment have such code: jquery(function($) { $(".s2").swipe({ excludedelements: "button, input, select, textarea, .noswipe", swipeleft:function(event, direction, distance, duration, fingercount) { $( '.boxplus-next' ).click(); }, swiperight:function(event, direction, distance, duration, fingercount) { $('.boxplus-prev').click(); }, triggerontouchend:false, threshold:15 }); }); it works fine, scrolls 1 image in carousel per touch. maybe it's possible restart function after triggering? thanks p.s. sorry english

javascript - CSS3 Infinite Loop Transition -

i trying animate clock having lot of trouble trying numbers loop infinitely. moving numbers incrementing translatey() when 59th second reached of other numbers fly past transitions 0. smooth transition on 0 continue 1 , on without showing in between. i've tried transition: none , animation-play-state: paused , transitionend event listeners , delays wasn't able use achieve i'm looking for. link code on jsfiddle http://jsfiddle.net/bwr4yz0s/ the code below outlines 1 failed attempt: /*seconds*/ if (sec === 0){ /*move fake 0*/ $("#secn").css({transform: 'translatey(-100px))'}); /*turn off animation*/ //$("#secn").css({transition: 'none'}); /*move actual 0*/ //$("#secn").css({transform: 'translatey(0px)'}); /*turn animations on*/ //$("#secn").css({transition: 'all 0.8s'}); } else{ vert = sec*20 + 'px'; $("#secn").css({transform: 'transl

regex - Limit the Number of Characters between Double Quotes using Oracle 11g PL/SQL -

i need way of applying substring limit of 32 characters each grouping of data inside double quotes, using oracle 11g pl/sql. basically using following example string provided me is, not have control of way string constructed: str := ‘"aaaaaaa bbbbbbb ccccccc dddddd1","aaaaaaa bbbbbbb ccccccc dddd",”qwerty”,”n1n1n1n1n1n1n1n1n1n1n1n1n1n1n1n1n1n1”’; i need go through each group of values between each double quote, example (“qwerty”) , apply substring of 32 every grouping found. so using above string example, it’s need perform following: str := ‘"substr(‘aaaaaaa bbbbbbb ccccccc dddddd1’,1,32)","substr(‘aaaaaaa bbbbbbb ccccccc dddd’,1,32)",”substr(‘qwerty’,1,32)”,”substr(‘n1n1n1n1n1n1n1n1n1n1n1n1n1n1n1n1n1n1’,1,32)”’; so in end, end result str consist of 4 groupings each grouping's length less or equal 32. any great. thanks. you can make use of regexp_replace . regexp_replace(str,'"([^"]{1,32})[^"]

selenium webdriver - "idle-timeout" in behat.yml for setting hte timeout value throws exception - -

added code profile follows. if remove idle-timeout works fine , if added gives exception- [symfony\component\config\definition\exception\invalidconfigurationexception] unrecognized options "idle_timeout" under "behat.extensions.behat_minkextension_extension.selenium2.capabilities" windows8_ie10: context: class: 'featurecontext' extensions: behat\minkextension\extension: selenium2: browser: internet explorer wd_host: seodevelopment:@ondemand.saucelabs.com/wd/hub capabilities: { "platform": "windows 8", "version": "10", "idle-timeout": 200} this happens because there table of recognised capabilities , idle-timeout not 1 of them. it's put in place filter out bad configuration , notify if messed up. work around use 'extra_capabilities' option, doesn't normalised , validated , won't throw error. unfortunately documentation doesn

objective c - ActionSheet clickedButtonAtIndex being used by 2 different actions -

currently following delegate listens selectedindex works takes action on index not belong action. action1: - (ibaction)sendpicture:(id)sender { uiactionsheet *popupquery = [[uiactionsheet alloc] initwithtitle:nil delegate:self cancelbuttontitle:@"cancel" destructivebuttontitle:nil otherbuttontitles:@"take photo",@"choose existing photo",nil]; popupquery.actionsheetstyle = uiactionsheetstyleblackopaque; [popupquery showinview:self.view]; } action2: - (ibaction)sendtip:(id)sender { uiactionsheet *popupquery = [[uiactionsheet alloc] initwithtitle:@"how want tip?" delegate:self cancelbuttontitle:@"cancel" destructivebuttontitle:nil otherb

Assembly function call from c -

i cannot combine kernel_entry.asm , main.c. main.c calls asm function sum . both nasm , gcc compiles respective files. however, linker gives error. kernel_entry.asm: [bits 32] [extern _start] [global _sum] .... _sum: push ebp mov ebp, esp mov eax, [ebp+8] mov ecx, [ebp+12] add eax, ecx pop ebp ret main.c: .... extern int sum(); void start() { .... int x = sum(4, 5); .... } to compile source files, use following commands: nasm kernel_entry.asm -f win32 -o kernel_entry.o gcc -ffreestanding -c main.c -o main.o .... ld -t nul -o kernel.tmp -ttext 0x1000 kernel_entry.o main.o mem.o port_in_out.o screen.o idt.o linker gives following error: main.o:main.c:(.text+0xa82): undifened reference 'sum' . tried couldn't find solution. when remove asm function call main.c, works. the tl;dr version of answer mixing nasm's -f win32 generates object file

node.js - Need an updated Twitter stream nodejs api -

can me better updated twitter stream api in nodejs? trying out ntwitter api pretty old , of methods aren't working. please suggest streaming api twitter in nodejs. kindly check below twitter api client node :- twit api //supports both rest , streaming api.

asteriskami - Asterisk ami/agi - not able to answer call -

i have followed instructions in thread: asterisk ami - pickup call . however, still unable answer calls via ami. can make call extension, corresponding phone extension doesn't ring. can run ami command answer call, answer, there isn't actual response. dialplan (testing extension 116): exten => 116,1,agi(agi:async) any ideas doing wrong here? use exten => 116,1,answer exten => 116,2,agi(agi:async) or use answer action via ami. http://www.voip-info.org/wiki/view/asterisk+manager+api you need listen event, when see agi-async event issue answer on same channel. example can playback command answer. very likly need start agi interface, more simpler understanding. not use agi:async, require understanding of asterisk internals.

python - Removing lines from file based on character/word ratio - unix/bash -

i have 2 files , need remove lines falls under token ratio, e.g. file 1: this foo bar question not parallel sentence because it's long hello world file 2: c'est le foo bar question creme bulee bonjour tout le monde and ratio calculated total no. of words in file 1 / total no. of words in file 2 , sentences removed if falls under ratio. then output conjoined file sentences file1 , file2 separated tab: [out]: this foo bar question\tc'est le foo bar question hello world\tbonjour tout le monde the files have same number of lines. have been doing followed how same in unix bash instead of using python? # calculate ratio. io.open('file1', , 'r', encoding='utf8') f1, io.open('file2', , 'r', encoding='utf8') f2: ratio = len(f1.read().split()) / float(len(f2.read().split())) # check , output file. io.open('file1', , 'r', encoding='utf8') f1, io.open('file2', , 'r', en

ruby on rails - With the state_machine gem, is there a way to make the events private/protected? -

i wondering if there's way make state event private when using state_machine gem? i have 3 states unpaid, pending, paid. when receipt in unpaid event can fired charge user. switches receipt pending (while talks merchant service) once done, call pay event , set state paid. the user of receipt class can technically call pay event, switch receipt paid though didn't run through merchant. note: contrived example... i strong believer in private , protected methods, , wondering how 1 engage them in context of state_machine implementation.. i'm assuming you're talking state_machine . you can make event transition methods private marking them after definition, e.g. class payment attr_reader :state state_machine :state, :initial => :pending event :pay transition [:pending] => :paid end end private :pay # should do! end even though answers question, highly advise against it. making method private or protected, concern

Android keyboard slides down leaving white space behind screen -

Image
when using fragment keyboard slides down leaving white space behind screen, here screen shot! when use without list view nothing come when use list view white screen appearing <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/list_parent" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <edittext android:id="@+id/abs__search_src_text" android:layout_width="0.0dip" android:layout_height="36.0dip" android:layout_gravity="bottom" android:layout_weight="1.0" android:

c# - Autofill not recognizing characters after slash -

Image
i'm trying use autofill in radtextbox, appeared working i'm having strange issue. here code: var tb = ((textbox)((radtextboxitem)txindexno1.rootelement .children[0].children[0]).hostedcontrol); var ls = lnq.nos.select(a => (a.index)).toarray(); tb.autocompletecustomsource.addrange(ls); tb.autocompletemode = autocompletemode.append; tb.autocompletesource = autocompletesource.customsource; the strings should be: (example) 123445/14 16277/14 however autofill until backslash ? is because escape character ?? any appreciated. this seems issue in .net textbox, radtextbox hosts. here issue replicated .net control: textbox tb = new textbox(); tb.parent = this; var ls = new string[] { "123445/14", "16277/14" }; tb.autocompletecustomsource.addrange(ls); tb.autocompletemode = autocompletemode.append; tb.autocompletesource = autocompletesource.customsource; i suggest use telerik's radtextboxcontrol , i

vb.net - Replace Strings Synchronously? -

i'm still considered beginner @ programming. i'm creating simple program create "upside down" style text, have run problem cannot solve. i check textbox , replace characters string.replace. example here: input = input.replace("d", "p") 'upside down d .... input = input.replace("p", "d") 'upside down p makes "d"s turn "p"s "d"s again. there method @ same time? i appreciate answer. thanks. iterate on characters 1 one, building new string in stringbuilder or stringbuffer , don't change original string reference got. edit - sample code here sample code, don't remember vb syntax suppose below correct: dim text string = "hello world" dim sb new stringbuilder() each c char in text if c = "a" sb.append("ɐ") if c = "a" sb.append("∀") ' ... ' ... ' rest of cases same way &#

javascript - how to change src of an img element even before the DOM loads -

i wondering if there exists carousel has bunch of images shown user, lets based on user, img shown in carousel needs change else. how can 1 change img src, before page loads? dom not exist dom element img element , change src new image? how can 1 it? i thinking may have inline script tag within head section async set false not block loading of dom. not sure. please let me know if there other alternatives or html5 features you can't use javascript access dom before loaded. best way deal compile html on server-side using templating language handlebars (depends on backend language is). however, if isn't option put place-holder loading symbol in place of image , dynamically add src url once <img> has loaded in dom , use js or jquery change src attribute. hope helps!

web services - SSLHandshakeException: Certificate Exception using HttpURLConnetion with Android 4.2.2 -

i struggling strange issue, while using httpurlconnection webservice api call in android. getting below exception only android version 4.2.2 . working fine in android 4.0.3, 4.3 , 4.4 , above. using below code service api call. httpurlconnection mconn = (httpurlconnection)murl.openconnection(); mconn.addrequestproperty("connection", "close"); mconn.setconnecttimeout(connection_timeout); mconn.setreadtimeout(socket_timeout); mconn.setusecaches(true); mconn.setrequestmethod("post"); string param = utils.appendqueryparams(null,this.stringparams); mconn.setdoinput(true); mconn.setdooutput(true); mconn.setfixedlengthstreamingmode(param.getbytes().length); mconn.setrequestproperty("content-type", "application/x-www-form-urlencoded"); mconn.setrequestproperty("accept", "application/json"); mconn.connect(); printwriter out = new printwriter(mconn.getoutputstream()); out.print(param); out.close(); here exception (onl

jquery - $ajax method does not execute for external javascript -

very stupidly question think, when put code inline works, when put on external js file can not debug after $ajax method. $.ajax({ type: "post", contenttype: "application/json; charset=utf-8", url: 'webservice/common/bank.asmx/getbank', data: "{}", datatype: "json", async: false, success: function (data) { debugger; ///debug point not reach here $.each(data.d, function (key, value) { $("#ddllcmasterbank").append($("<option></option>").val(value.bankid1).html(value.bankname1)); }); }, error: function (result) { alert("error"); } });

c# - How to write this line in C++/CLI? -

i'm using visual c++ call web service. need bypass invalid ssl certificates since i'm getting error - the request failed. underlying connection closed: not establish trust relationship ssl/tls secure channel. while writing same thing in c#, used line - system.net.servicepointmanager.servercertificatevalidationcallback = delegate { return true; }; and worked me. how achieve same thing in visual c++? how write same line in visual c++? you need create callback object explicitly , assign corresponding property. using namespace system; using namespace system::net; using namespace system::net::security; using namespace system::security::cryptography::x509certificates; static bool validateservercertificate( object^ sender, x509certificate^ certificate, x509chain^ chain, sslpolicyerrors sslpolicyerrors) { return true; } int main(array<system::string ^> ^args) { // create callback object, pointing

c++ - How to position item, Qpixmap, Qstring in a QGraphicScene/QGraphicView in qt? -

i add qpixmap , string qgraphicscene , setscene qgraphicview. qpixmap , string stay in middle of qgraphicscene. how can change position of these? can use layout manager this? you can use qgraphicsitem::setpos function set position of item.

sql - MS Access 2002/VBA - join a number of lookup tables to main query? -

consider: contact ======= contact_id, not null name, not null electorate_id, null allowed member_type_id, null allowed member_types ===========+ member_type_id member_type electorates =========== electorate_id electorate these tables wish use populate form. have tried few ways, query returns no data: select contact_id, name, member_type, electorate contact left join member_types on contacts.member_type_id=member_types.member_type_id, contacts left join electorates on contacts.electorate_id=electorates.electorate_id also: "select contact_id, name, member_types.member_type, electorates.electorate contacts, member_types, electorates contacts.contact_id=" & contact_id & " , electorates.electorate_id=contacts.electorate_id , member_types.member_type_id = contacts.member_type_id" both of these fail. can suggest query works please? select contact_id, name, member_type, electorate contact left join member_types on contact.member_type_

imap - Access of single gmail account to multiple users -

i want give access single gmail account around 10 users provide read-only access gmail account via thunderbird client persons using can see mails , not delete them. issue imap if 1 of users delete mail deleted users. issue pop first user access mail can download attachments. please suggest suitable solution. the best solution in case use pop3 access , set in tb clients "leave messages on server @ xxx days". can change option selecting account in account treeview, opening context menu , selecting "settings..."; in newly opened window select tab "server settings". must sure user not change option once you've set. can't set access tb client in readonly mode (and if via add-on, skilled user bypass it).

android - Undefined Extern Reference in Eclipse -

i'm trying compile simple c++ code in eclipse compiles fine in visual studio. i have following files (renamed , simplified clarity). main.cpp has other boilerplate code in main function , forth, i've omitted. foo.h #ifndef foo_h #define foo_h extern int foo; #endif foo.cpp int foo = 0; main.cpp #include "foo.h" void bar() { foo = 1; } when try compile in eclipse, following error (omitted long paths) main.o: in function bar():jni/main.cpp:25: error: undefined reference 'foo' collect2: ld returned 1 exit status if hover mouse on foo in main.cpp, shows tooltip it, , if right click on , select open declaration, takes me foo.cpp , highlights foo declaration. finding it, failing compile. if move declaration main.cpp, below, compiles fine. main.cpp #include "foo.h" int foo = 0; void bar() { foo = 1; } so reason, eclipse not seeing declaration when placed in different cpp file 1 referencing it. why that, , how fix it?

php - HTACCESS friendly urls with parameters 2 -

i have little problem. redirect in .htaccess from: domena.pl/index.php?galeria to domena.pl/galeria work fine need redirect domena.pl/index.php?galeria=inne to domena.pl/galeria/inne too , give me redirect loop. my .htaccess is: rewriteengine on rewritebase / rewritecond %{http_host} ^domena.pl(.*) [nc] rewriterule ^(.*)$ http://www.domena.pl/$1 [r=301,l] rewritecond %{the_request} \s/+index\.php\?([^\s=]+?)\s [nc] rewriterule ^ /%1? [r=301,l,ne] rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^([a-z-]+)$ index.php?$1 [l,qsa] rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^([a-z]+)/([a-z-]+)$ index.php?$1=$2 here example of have done on site: options +followsymlinks -multiviews # turn mod_rewrite on rewriteengine on rewritebase / # external redirect /view.php?id=1 /view/id/1 rewritecond %{the_request} ^[a-z]{3,}\s/+([^.]+)\.php\?([^=]+)=([^\s&]+) [nc] rewriterule

java - Spring 4 + Tiles (3 || 2.2.2) - Any way to access beans in view context? -

i trying access beans in tiles view. tried solutions: solution 1 tried the solution accessing spring beans tiles view (jsp) francarl posted (servletcontextattributeexporter) working fine on first view (hello.jsp, not theme.jsp). <?xml version="1.0" encoding="iso-8859-1" ?> <!doctype tiles-definitions public "-//apache software foundation//dtd tiles configuration 3.0//en" "http://tiles.apache.org/dtds/tiles-config_2_0.dtd"> <tiles-definitions> <definition name="defaulttheme" template="/web-inf/views/theme.jsp" /> </tiles-definitions> i can access bean in hello.jsp not in /web-inf/views/theme.jsp solution 2 tried tried skaffman solution, 'tilesexposingbeansviewresolver', executing , buildview , it's code view.setexposecontextbeansasattributes(this.exposecontextbeansasattributes); executed too. rendermergedoutputmodel view class not executed. tri

Outlook responsive Image in table not working / outside table is working -

i'm working in responsive newsletter , i'm finished. in last 2 weeks read issues , things mess when coding responsive newsletter. my newsletter ready use , responsive face problem cant solve since 2 days. i got image responsive in outlook: <img src="#" style="width:230px;max-width:96%;border:0px;" width="230"> and table responsive in outlook: <table width="800" style="width:800px;max-width:96%;text-align:justify;font-family:arial;color:black;font-size:14px;line-height:1.2em;"> <tr> <td style="text-align:justify;font-family:arial;color:black;font-size:14px;line-height:1.2em;"> mass-text </td> </tr> </table> so far - works great. if put image in table isn't responsive anymore: <table width="800" style="width:800px;max-width:96%;text-align:justify;font-family:arial;color:black;font-

How to write C# case insensitive LIKE statement for SQLIte using ICU extension? -

sqlite have limitation on using non-ascii symbols. icu extension solves problem. how write code in c# creating following case insensitive statement: select * persons surname '%Пупкин%' p.s. if there solution using in c# statement non-ascii symbols please provide it. c# code var lst = (from p in persons p.surname.indexof(searchtext, stringcomparison.invariantcultureignorecase) >= 0 select p).tolist() invariantcultureignorecase 1 of options of string.indexof methods. might achieve c#

c++ - error: no matching function for call to default copy constructor? -

i have std::map container variable in class populated objects of nested-class : class logger { private: //... class tick{ ///stores start , end of profiling uint32_t start, lasttick,total; /// used total time boost::mutex mutextotaltime; ///is profiling object started profiling? bool started; public: tick(){ begin(); } /* tick(const tick &t){ start = t.start; lasttick = t.lasttick; total = t.total; started = t.started; } */ uint32_t begin(); uint32_t end(); uint32_t tick(bool addtototaltime = false); uint32_t addup(uint32_t value); uint32_t getaddup(); }; std::map<const std::string, tick> profilers_; //... public: //... logger::tick & logger::getprofiler(const std::string id) { std::map<const std::string, tick>::iterator it(profilers_.find(id));

excel - VBA javascript onlick -

i been trying adapt code working no success. need submit guest following webpage: <div class="lotusbtncontainer"> <input type="submit" class="lotusbtn" value="access guest"onclick="javascript:asguest();"> <input type="submit" class="lotusbtn" value="log in , access" onclick="javascript:asuser();"> <span class="lotusaction"> &nbsp;</span> </div> this have far, since button doesn't have id i'm not sure how address it: dim intexpl object set intexpl = createobject("internetexplorer.application") intexpl .navigate "webpage url" .visible = true until intexpl.readystate = 4 loop '.document.getelementsbyname("subaction")(0).click end end sub this worked. dim intexpl object set intexpl = createobject("internetexplorer.application") intexpl

angularjs - Updating angular $scope variable inside forEach loop -

i have quite extensive filter/faceted search application. data loaded via api, , displayed on page using ng-repeat. there's google map instance has marker associated every item. application quite demanding in terms of computation. guess might overloading clients weaker machines in end. that's enough of background. have got working way want. i'm looking performance gains , more effective ways accomplish goals. now i'm trying figure out whether better update $scope variable (which array) inside foreach loop, or update private array , update $scope variable after loop? so $scope.myarraywithalltheitems = []; $scope.myarraywithitemkeystobedisplayed = []; $http({method: 'get', url: '/myapiurl'}).success(function(data, status, headers, config) { if (angular.isarray(data)) { angular.foreach(data, function (item, key) { /* prework on item object here */ //update scope variable every foreach iteration

CSS / jQuery: limit dropdown max-height to screen height -

i have html page needs show lot of content in dropdowns in navbar on top leads of dropdowns exceed screen height when opening them. use bootstrap 3 , have own dropdowns created using unordered list ( <ul> ) tags. if apply following css resolves issue , gets me vertical scrollbar want in case. problem here max-height fixed value. note: need able support ie8 , ie9. is there way use css or jquery set screen height (or bit less) max-height adjusts if screen height changes, esp. support smaller screens ? my css: <ul class="dropdown-menu" style="max-height:300px; overflow:auto"> many this, tim. this set list's height not overflow screen. try this: $(function(){ $(window).resize(function(){ $('ul').css('max-height', ($(window).height() - $('ul').offset().top) + 'px'); }); });

client side templating - Is there a Facelets-like feature in AngularJS where views define the template and its replaceable parts? -

if know facelets, isn't simple jsp include or angular ng-include template defines contents should in template. in facelets, template defines parts of dynamic or replaceable , view can use , tell contents should in replaceable parts of template. in facelets, single page can feed replaceable parts of template in one file . facelets example: template: template.xhtml: <h:body> <div> <ui:insert name="main_section">main section</ui:insert> </div> <div> <ui:insert name="section">section</ui:insert> </div> <div> <ui:insert name="sub_section">sub section</ui:insert> </div> </h:body> view: somepage.xhtml <ui:composition template="./template.xhtml"> <ui:define name="main_section"> welcome main section defined somepage.xhtml

protractor - Require: Doesn't find a file (Page Object Pattern) -

i'm trying incorporate page object pattern in protractor testing reason don't know it's not working. must before doing change, running perfect. in test folder have file test.spec.js this: 'use strict'; var loginpage = require('../pages/login.page.js'); describe('login --> ', function(){ 'use strict'; var ptor; var page; beforeeach(function () { page = new loginpage(); ptor = protractor.getinstance(); ptor.waitforangular(); }); describe('false login --> ', function(){ it('it should false login pin --> ', function(){ /* code */ }); }); }); and in same folder got 1 called "pages" , inside of file login.page.js. when run tests doesn't find login.page.js. "error: cannot find module '../pages/login.page.js'" anyone knows why? thanks guys ;) if folder pages located in same folder

c++ - Convert char* to uint8_t -

i transfer message trough can protocol . to so, can message needs data of uint8_t type . need convert char* uint8_t. research on site, produce code : char* bufferslidepressure = ui->candatamodifiabletablewidget->item(6,3)->text().toutf8().data();//my char* /* conversion */ uint8_t slidepressure [8]; sscanf(bufferslidepressure,"%c", &slidepressure[0]); as may see, char* must fit in sliderpressure[0] . my problem if have no error during compilation, the data in slidepressure totally incorrect . indeed, test char* = 0 , 've got unknow characters ... think problem must come conversion. my datas can bool, uchar, ushort , float . thanks help. is string number? e.g. char* bufferslidepressure = "123"; ? if so, do: uint8_t slidepressure = (uint8_t)atoi(bufferslidepressure); or, if need put in array: slidepressure[0] = (uint8_t)atoi(bufferslidepressure); edit: following comment, if data anything, g

jquery - Unable to submit form using Javascript -

i trying submit form named 'vform' using javascript , ajax.here button named 'show' being used show 'div' containing form named vform , form calls codevalidate function , there submits form using ajax code..where getting error vform.submit().here's html , js code(i know error in if condition not know where) html: <button id="show" onclick="javascript:codefield(); return false";>apply discount</button> <div id="apply" style="display:none">voucher code<br> <form id="vform" name="vform" action="" method="post" onsubmit="javascript:codevalidate(); return false;" > <input type="text" name="code" id="code"><br> <span id="error" style="color:red"></span><br> <input type="submit" name="

vb.net - how to use id of a button in if statement using javascript -

i beginner javascript , trying perform arithmetic functions. here code below: script <script language="javascript" type="text/javascript"> function func(a,b) { var = document.getelementbyid("a"); var b = document.getelementbyid("b"); if (document.getelementbyid("btnadd").text == 'add') { var c = + b; document.getelementbyid("rslt").innerhtml =c; } } </script> aspx <asp:button id="btnadd" text="add" runat="server" onclientclick="func(txtn1,txtn2)" /> <p id="rslt"></p> my idea is, when click 'add' button value of 2 textbox should passed script , assigned 2 variables. with 2 variables arithmetic (add,sub,div,mul) should done. what pass button clicked, using this . way know text of button clicked. , since usi

laravel - Custom Filter Class - more than one filter in class -

i've read number of tutorials on custom filters. here how custom filter set up: class mycustomfilter { public function filter($route, $request) { } public function filter2($route, $request) { } } in filters file have: route::filter('my_filter', 'mycustomfilter'); is there way have more 1 filter in class? i've tried calling so: route::filter('my_filter', 'mycustomfilter.filter2'); but no luck. you should able achieve using class@method route::filter('my_filter', 'mycustomfilter@filter'); route::filter('my_filter', 'mycustomfilter@filter2');

java - New Liferay project- there is no such an option -

Image
i want create new liferay project there no option "create new liferay project" in eclipse ide, there either "new liferay plugin project" or "new liferay project existing source" can tell me why there no possibility create new liferay project ? what expect "liferay project" that's not "liferay plugin project"? this naming glitch on both command's titles - in fact, both commands denote "plugin projects" liferay, despite different names. when create new plugin project, chance define plugin type in wizard dialog. when import (plugin) project, plugin type derived actual project's content.

c# - Selecteddate not updated in wpf datepicker when datepicker contains plain wpf textbox -

i have extended wpf date picker control , in styles changed template date picker textbox style. put textbox in control template of datepickertextbox: <style x:key="datepickertextboxstyle" targettype="{x:type datepickertextbox}"> <setter property="height" value="20" /> <setter property="control.template"> <setter.value> <controltemplate> <textbox x:name="part_textbox" style="{dynamicresource calendartextboxstyle}" tabindex="0" text="{binding path=selecteddate, stringformat='d', converterculture={x:static glob:cultureinfo.currentculture}, relativesource={relativesource ancestortype={x:type maskeddatepickerlib:maskeddatepicker}}}" textwrapping="wrap"> </textbox> </controltemplate> </setter.value> </setter> </style> i have overridden

lucene - Elasticsearch - How to normalize score when combining regular query and function_score? -

idealy trying achieve assign weights queries such query1 constitutes 30% of final score , query2 consitutes other 70%, achieve maximum score document has have highest possible score on query1 , query2. study of documentation did not yield hints how achieve lets try solve simpler problem. consider query in following form: { "query": { "bool": { "should": [ { "function_score": { "query": {"match_all": {}}, "script_score": { "script": "<some_script>", } } }, { "match": { "message": "this test" } } ] } } } the script can return arbitrary number (think-> can return 12392002). how make sure result script not dominate

python - time.clock(), Odd result when used inside function-definition -

using following code (python 3.3.x, winxp): ## debug function in general/personal debug include file. def timer_compare(time1, time2='', note='@', time3=time.clock()): print('time1',time1) time2 = time.clock() ## same function-passed time.clock() (just little later) print('time2',time2) print('time3',time3) exit(321) caller code used in main code file: time0 = time.clock() ## <other unrelated code.> timer_compare(time0, time.clock()) i following output: time1 0.0445(snip) time2 0.0445(snip) time3 0.0000043(snip) <- 4.385582001116343e-06 time3 here seems have way low number. (it kinda looks pulled newly created timer case.) what's going on here / i'm missing ? i know time.time() preferred/advised on time.clock(), , why. function defaults created at definition time , not when called. timer_compare function object , defaults evaluated when created , stored attribute on object. s

How to edit stock availability of product in admin enhanded grid free extension of Magento -

i able show stock availability column in products grid of admin manage products. , have installed free extension named enhanced admin grid site url http://www.magentocommerce.com/magento-connect/enhanced-admin-grids-editor.html . working fine. need edit stock availability functionality of status of admin enhance grid. have had google search lot, there no solution. if 1 knows development, please reply me

How to access firebreath plugin from Internet Explorer Extension -

i have created extensions chrome, firefox , safari can use firebreath plugin defining object in background.html or panel.html , interacting plugin functionalities using js. i @ dead end ie extensions. what have tried far create context menu or tool's menu using registry, not sure how can use firebreath plugin . start ? i looking simple sample code or steps can solve above problem. any appreciated. firebreath plugins added active x objects in windows. can access active x objects via thing viz (javascript, c# programs , etc etc). for simulating normal behaviours in firefox or chrome extension , need create bho (browser helper objects) gives functionality interact content page. bho act content script. bho created in visual studio using c#. more details on how create bho can found @ codeproject.com

unmarshalling - JavaScript equivalent of .NET XML Deserialization -

i'm looking javascript library can deserialize/unmarshal xml (strings or dom) javascript classes in way similar .net xmlserializer's deserialize method. the functionality i'm looking for: classes defined javascript constructor functions. mapping between nodes , classes/properties configurable. deserialization result consists of instances of these classes. for example, following xml: <root textattribute='text1' numberattribute='1' attributetoignore1='ignored1' attributetoignore2='ignored2'> <children> <child>text2</child> <child>text3</child> </children> <childtoignore>ignored3</childtoignore> </root> used javascript definitions similar these: function rootclass() { this.stringproperty = ""; this.integerproperty = 0; this.collectionproperty = []; } function childclass() { this.stringproperty = ""; } should produce jav

javascript - Is it possible to capture the scroll wheel click -

i've written code, when user clicks on link (i'm using jquery's .click() ), modal popup telling them they're being redirected different site. works fine normal left click, however, clicking link using middle mouse button open in different tab loads page straight away rather showing modal. ideally i'd show them modal too, after timer finishes open in new tab them. is possible capture click too? try this, help $("yourtag").on('mousedown', function(e) { if( (e.which == 1) ) { alert("left button"); }if( (e.which == 3) ) { alert("right button"); }else if( (e.which == 2) ) { alert("middle button"); } e.preventdefault(); }).on('contextmenu', function(e){ e.preventdefault(); });

java - Set the maximum capacity of JList? -

i trying set maximum capacity of jlist 5 elements. can seem find way of setting minimum using .capacity(). there anyway of setting maximum 5 , dialogue box displayed when exceeds limit? far have this: string getprocessname = ""; getprocessname = jtextfield1.gettext(); if (info.size() >= 5) { joptionpane.showmessagedialog(null,"5 elements reached"); } else { info.addelement(getprocessname); } this displays error message still adds next value on list. suggestions? jframe frame = new jframe(); //other frame "stuff" jlist list = new jlist(new object[]{"121", "131", "141", "151" , "111", "181"}); list.setselectionmodel(new myselectionmodel(list, 5)); //<-- magic line right here frame.setvisible(true); this accomplishes task setting size of custom selection model 5.