Posts

Showing posts from March, 2010

javascript - Why doesn't the toggle toggle? -

newb here attempting learn how work jquery way of investigating 'the toggle' i have simple html page , thought second link load collapsed/hidden , when clicked reveal it's contents, not. instead displays screen inner html exposed (hope i'm using terms correctly). believe happening jquery not loading, thats best guess of hobbyist, out there can me work. <html> <head> <script src="http://code.jquery.com/jquery-1.8.3.min.js"></script> <script> $.fn.slidefadetoggle = function(speed, easing, callback) { return this.animate({ opacity: 'toggle', height: 'toggle' }, speed, easing, callback); }; // collapse first menu: $("#accordionmenu li a").not(":first").find("+ ul").slideup(1); // expand or collapse: $("#accordionmenu li a").click(function() {

what's the formula of ONVIF #PasswordDigest -

i'm working on onvif of send "getdeviceinformation". that's required wsse:usernametoken. after searching data authority, there 2 faormula: (1) "onvif-core-specification-v241.pdf", "5.12.2.1 password derivation" pe_ua = base64(hmac_sha-1(ua+p_ua,nep+”onvif password”)) (2) soap of web protocol digest = b64encode( sha1( b64decode( nonce ) + date + password ) ) i confused!!which 1 correct? moreover, when test onvif test tool wireshark the xml got as: <wsse:usernametoken> <wsse:username>admin</wsse:username> <wsse:password type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#passworddigest">lu9ywjdwst8ow7m4tmjcb50/xrg=</wsse:password> <wsse:nonce>tgbyfhxsc3oo8ypzwnqn8a==</wsse:nonce> <wsu:created>2014-06-20t04:41:45z</wsu:created> </wsse:usernametoken> ok, i've try figure out formula data. a> username: "admin&qu

How to setup Postfix for Ruby On Rails to send email -

i want have postfix send email in ror project. safer , hax more functionality. but i'm quite lost. installed postfix , got ror working. next should do? (i need send email, not receive @ moment) should configure postfix , make able send email in comment line first, integrate ror? if so, how should set configure file in postfix , , how settings in rails ? or need every setting in rails ? if so, should detailed setting? i'm quite confused. lots of tutorials either not working or not suit situation. example action mailer configuration an example adding following appropriate config/environments/$rails_env.rb file: config.action_mailer.delivery_method = :sendmail # defaults to: # config.action_mailer.sendmail_settings = { # location: '/usr/sbin/sendmail', # arguments: '-i -t' # } config.action_mailer.perform_deliveries = true config.action_mailer.raise_delivery_errors = true config.action_mailer.default_options = {from: 'no-repl

How do I install a custom build of asp.net vnext KRuntime? -

i built kruntime using appveyor. artifacts artifacts\build\*.nupkg in nuget feed . how install kruntime build using version manager ? try downloading package local machine, then: kvm install kre-svr50-x64.1.0.0-t140627040749.nupkg your milage may vary. output: c:\users\chris\downloads>kvm install kre-svr50-x64.1.0.0-t140627040749.nupkg unpacking c:\users\chris\.kre\packages\temp installing c:\users\chris\.kre\packages\kre-svr50-x64.1.0.0-t140627040749 cannot find kre-svr50-x86.1.0.0-t140627040749, need run 'kvm install 1.0.0-t140627040749'?

html - Box-shadow only on right and left -

Image
i need make box-shadow on right , left of element. should fade , thinner top , bottom. shouldn't oveflow on top , bottom. the main issue can't prevent shadow overflow on top , bottom of element. this have : html : <div></div> css : div{ box-shadow: 0px 0px 20px 0px #000000; } you need use 2 box-shadows 1 left shadow , 1 right one. need specify both box-shadows in same box-shadow attribute , seperate them coma : box-shadow: -60px 0px 100px -90px #000000, 60px 0px 100px -90px #000000; both need have negative spread value shorter divs height , don't overflow on top , bottom. demo output : you need tweak values of shadow in order adapt size of element want use on. html : <div></div> css : div{ height:500px; width:300px; margin:0 auto; box-shadow: -60px 0px 100px -90px #000000, 60px 0px 100px -90px #000000; }

search - Searching a value in an aribitrary structure in C -

if have structure this. [code] cogmacframe.header.destaddr = dest; cogmacframe.header.cogparam = nextchan; cogmacframe.header.somethingidontknowbutiaminterested = 10; cogmacframe.header.somethingidontknow = xyz; [/code] here, if don't know fields of structure know 1 of unknown field take value lets 10. need search value of 10 , field value. can , how ? i working in warpboard uses c language .the structure macframe header. header received unknown node using own header format don't know fields know 1 of field take particular value , need search value , access field.

sql - Display the details of the employees who have been hired after the employee 'Jack' was hired -

below code display details of employees have been hired after employee 'jack' hired all of information in single table. my query: select e.employee_name, e.hiredate employees e e.employee_hiredate > jack.hiredate; to 'jack' table, need join: select e.employee_name, e.hiredate employees e join employees jack on jack.employee_name = 'jack' e.employee_hiredate > jack.hiredate; alternatively can use subquery: select e.employee_name, e.hiredate employees e e.employee_hiredate > (select hiredate employees employee_name = 'jack'); this article may give better explanation on how joins work, , this article explain bit subqueries.

c++ - Is std::swap(x, x) guaranteed to leave x unchanged? -

this question based on discussion below recent blog post scott meyers . it seems "obvious" std::swap(x, x) should leave x unchanged in both c++98 , c++11, can't find guarantee effect in either standard. c++98 defines std::swap in terms of copy construction , copy assignment, while c++11 defines in terms of move construction , move assignment, , seems relevant, because in c++11 (and c++14), 17.6.4.9 says move-assignment need not self-assignment-safe: if function argument binds rvalue reference parameter, implementation may assume parameter unique reference argument. ... [ note: if program casts lvalue xvalue while passing lvalue library function (e.g. calling function argument move(x)), program asking function treat lvalue temporary. implementation free optimize away aliasing checks might needed if argument lvalue. —end note ] the defect report gave rise wording makes consequence clear: this clarifies move assignment operators need not perfo

c++ - To find combination value of large numbers -

i want find (n choose r) large integers, , have find out mod of number. long long int choose(int a,int b) { if (b > a) return (-1); if(b==0 || a==1 || b==a) return(1); else { long long int r = ((choose(a-1,b))%10000007+(choose(a-1,b- 1))%10000007)%10000007; return r; } } i using piece of code, getting tle. if there other method please tell me. i don't have reputation comment yet, wanted point out answer rock321987 works pretty well: it fast , correct , including c(62, 31) but cannot handle inputs have output fits in uint64_t. proof, try: c(67, 33) = 14,226,520,737,620,288,370 (verify correctness , size) unfortunately, other implementation spits out 8,829,174,638,479,413 incorrect. there other ways calculate ncr won't break this, real problem here there no attempt take advantage of modulus. notice p = 10000007 prime, allows leverage fact integers have inverse mod p, , inverse unique. fu

javascript - jquery change svg fill color twice -

i'm trying change color of svg object jquery, after want reset fill attribute in class st24. after reset setattribute doesn't work. //Автокомплит $(function() { $( "#users" ).autocomplete({ source: function( request, response ) { $.ajax({ cache: true, url: "http://127.0.0.1/json.php", datatype: "json", success: function(data) { response($.map(data, function(item){ return { label: item.username, placeid: item.locationinfo.placeid, }})); } }); }, minlength: 2, select: function(event,ui) { $('#users').val(ui.item.username); $('#placeid').val(ui.item.placeid); console.log(ui.item.placeid); console.log(svgdom); var svgelement = svgdom.getelementbyid(ui.item.placeid); //Если id еле

Adding an option to Post to Twitter from ASP.NET MVC 5 -

i have asp.net mvc 5 application need post twitter. the requirement able have twitter link, clicking on user taken twitter login page. user logs in using twitter credentials , redirected mvc 5 app. here there text box user enter tweet appear on user's twitter page. here's have till now: mvc 5 application created twitter app , have api key, api secret , have callback url i have read twitter uses key based authentication. , how work in terms of asp.net mvc5 what next steps after second step? package(s) needed integrating twitter asp.net mvc 5? can please or point resource can guide me? i new , having tough time trying understand this. want document process next developer doesn't have go through this. thanks in advance. regards. you use tweet sharp (nugget), still need logged user accesstoken , accesstokensecret instantiate tweet sharp service. take great post: http://www.jerriepelser.com/blog/get-the-twitter-profile-image-using-the-asp-net-ide

android - Intel HAXM not working on i5-2430M (2nd Gen) -

i setting haxm android x86 emulator. downloaded haxm , x86 image using sdk manager. installed haxm, rebooted, still haxm isn't shown working while emulator starts up. i've tried installing haxm directly intel website. still doesn't work. i've enabled virtualization bios. system: hp pavilion g6 1201-tx, windows 7 ultimate x64, intel 2nd gen i5-2430m thanks in advance! try these three steps: 1.hax software located in c:\program files\android\android-sdk\extras\intel\hardware_accelerated_execution_manager install haxm driver running "intelhaxm.exe" in command prompt. 2.. if installer fails message intel vt must turned on, need enable in bios . for eg: if using windows 7, press f12 key enter bios setting. there can see intel virtualization technology placed in system performance .turn on enabled 3.then again run "intelhaxm.exe" in command

websocket - Pure TCP Socket vs Web Socket for Notification from Web Server to Client Application -

currently have php web application sends notification frontend client(running in browser) via websockets. developing client (desktop application written in c / c++) needs receive notifications web application. scenario(communication between desktop application , web server) better use tcp socket or websockets. advantage of web sockets on tcp in terms of firewall, security, speed , resource conception. if using tcp socket better should binding , listening (http server or desktop client) i have referred following questions before posting question differences between tcp sockets , web sockets, 1 more time the main difference browsers websocket capable. standard, has better interoperability. has little overhead. if roll own tcp connection, still need frame data, end doing similar. websocket protocol simplistic. a websocket connection starts http or https, more go through firewalls. , proxy vendors update software websocket friendly, because standard.

c++ - Passing STL algorithm to another function -

i have vector of user defined type (student). have 2 functions identical except single function call inside them. here 2 functions: student lowest_grade(const std::vector<student> &all_students){ return *std::min_element(std::begin(all_students), std::end(all_students), [](const student &a, const student &b){ return a.get_average() < b.get_average();}); } student highest_grade(const std::vector<student> &all_students){ return *std::max_element(std::begin(all_students), std::end(all_students), [](const student &a, const student &b){ return a.get_average() < b.get_average();}); } both of these functions working correctly use seems constructed better. want create function pass in either min_element or max_element, like: template <typename func> student dispatch(const std::vector<student> &all_students, func){ return *func(std::begin(all_students), std::end(all_students), [](const student

ios - Possible rejection of application using Apple Push notifications -

i'm reading app store review guidelines , , curious point related push notifications rules. rule, confuses me, , second part: apps send push notifications without first obtaining user consent, apps require push notifications function, rejected first part clear : apps send push notifications without first obtaining user consent... that means,that alert registering of push notifications needs shown, meaning of second part : ... apps require push notifications function ... is means,that if have messaging app, uses push notifications wake rejected, because push notifications heart of app this?

android - How to solve array out of bound exception? -

this code , getting array out of bound exception.how solve error?i used bitmap object instead of string .when store bitmap image array list got error. mainactivity.java public class mainactivity extends activity { listview lv; context context; arraylist prgmname; bitmap bitmap; //bitmap=getbitmapfromurl("http://content6.flixster.com/movie/11/17/75/11177548_pro.jpg"); public static string [] prgmnamelist={"let c","c++","java","jsp","microsoft .net","android","php","jquery","javascript"}; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); bitmap=getbitmapfromurl("http://content6.flixster.com/movie/11/17/75/11177548_pro.jpg"); context=this; bitmap [] prgmimages ={bitmap,bitmap}; lv=(listview) findviewbyid

css3 - jQuery - when btn is clicked on form with empty fields, the background color and text fade in -

see fiddle css .fade-in{ background-color: #ff9696; -webkit-transition: background 0.5s linear; -moz-transition: background 0.5s linear; -ms-transition: background 0.5s linear; -o-transition: background 0.5s linear; transition: background 0.5s linear; opacity: 1; } .alerterror{ background-color: #ff9696; color: red; padding: 15px 0; opacity: 0; } jquery $('.box-button').click(function() { $('.alerterror').fadein('slow', function() { $(".alerterror").addclass('fade-in'); }); }); html <div class ="alerterror">missing fields</div> <button class="box-button"> example </button> trying ages fade in background color , error text when form button submitted empty fields. no avail. have feeling css or jquery might not right or working. any appreciated. fiddle demo just change position of css classes .alerterror {

tfs2012 - Migrating on-premise TFS 2012 to VSO with free opshub tool -

we moving on-premise tfs 2012 visual studio online environment. need move lot of projects, of them aren’t problem free opshub tool. but 2 of our projects big , tool take 8~9 days complete migration, long us. what following: start migration on-premise vso keep working in on-premise after migration has finished, migrating commits made in last 8~9 days. i’m not sure free opshub tool supports this. there way free tool? if how work? that feasible. start migration initially, initial run completed, , status of migration goes not running, go view progress page, , start configured migration. this pick newly added changes, done on-premise instance, after actual migration started. note : process vs total revision count mismatch in status page in such cases, total count not calculated once @ start of migration.

Magento Export products from admin -

i want export products admin. when selecting entity type "products" loading whole page layout in entity attribute area. please suggest issue here. it loads entity attribute area give possibility skip attributes being exported. you can click 'continue' @ bottom continue product export attributes.

java - could parent object be created using super to call parent method -

would parent object created , if use super keyword call method of parent class in child object? outcomes show both mybase , mysub have same reference address. not sure whether demo. class mybase { public void address() { system.out.println("super:" + this); system.out.println( this.getclass().getname()); } } class mysub extends mybase { public void address() { system.out.println("this:" + this); system.out.println( this.getclass().getname()); } public void info() { system.out.println("this:" + this); super.address(); } } public class supertest { public static void main(string[] args) { new mysub().info(); } } well, let's find out! your test isn't quite going answer question. if want see if object created, why not create constructor prints console when called? public class test { static class parent { parent() { system.out.println("parent constructor cal

c# - System.Net.FtpClient - changing access right to file -

i have problem net.ftpclient. how change rights file on server. use execute error: chmod not understood if (!(reply = conn.execute("chmod 666 file.txt")).success) { throw new ftpcommandexception(reply); } package from: https://netftp.codeplex.com/ try solution if (!(reply = conn.execute("site chmod 666 file.txt")).success) { throw new ftpcommandexception(reply); } refer here documentation if doesn' work check if server running under windows system. if yes not allow set file permissions via ftp (unix-running servers allow that). if hosting provider has web-based control panel allows set file permissions go there , make changes.

class - objects not working in SDL (C++) -

i working on simple game in c++, sdl api. put image bliting functions in class on separate document less messy on main file. however, when try call functions using object class, ide says making undefined reference functions. here main file: #include "sdl/sdl.h" #include "sdl/sdl_image.h" #include "sdl/sdl_ttf.h" #include "imageblitingfunctions.h" #include <iostream> #include <string> #include <sstream> int screenw = 640; int screenh = 480; int screenbpp = 32; sdl_surface* window = sdl_setvideomode(screenw, screenh, screenbpp, sdl_swsurface); imageblitingfunctions ibfobject; sdl_surface* background1; sdl_surface* player1; int main(int argc, char* args[]) { sdl_init(sdl_init_everything); ttf_init(); background1 = ibfobject.loadimg("background.png"); player1 = ibfobject.loadimg("swordtest.png"); ibfobject.blitimg(0, 0, window, background1, 0, 0, 1000, 1000); ibfobject.blitim

java - Tomahawk tabel parts -

in many faces paginator , column headers part of datatable. (primefaces, icefaces) with tomahawk possible use datascroller paging datatable. , datascroller not part of datatable. seen in balusc paging , sorting example . unfortunately tomahawk api not documented , there not many examples. here question: possible use datatable sort columns of datatable? thanks in advance. to answer own question. in end used normal html table , commandlinks sorting data in backingbean. thank time.

android - View taking the place/position of another view in custom adapter -

i have list of images i'm showing, using universal image loader, i'm trying put ad in between in position 4, ad replacing image in position.. when looking @ positions , urls seems ok. there wrong custom adapter? or possible in xml? @override public view getview(int position, view convertview, viewgroup parent) { int type = getitemviewtype(position); system.out.println(position+" "+urls.get(position)); if (convertview == null) { holder = new viewholder(); switch (type) { case tilbud: convertview = minflater.inflate(r.layout.image_row, null); holder.imageview = (imageview)convertview.findviewbyid(r.id.image_row); imageloader.displayimage(urls.get(position), holder.imageview, options); break; case ad_space_1: convertview = minflater.inflate(r.layout.ad_space_row

c - How to convert netmask to network prefix length? -

i doing programming, wanna convert netmask network prefix length. for example 255.255.255.0 ----> 24. finally write code so. const char *network = "255.255.255.0"; int n = inet_addr(netowrk); int = 0; while (n > 0) { n = n << 1; i++; } i network count you should first try compile code, can lot. there compilations errors because mistyped variable name "netowrk" to calculate prefix instead left shift should try right shift , instead of using inet_addr try inet_pton() . for more details go through post ipv4 decimal different values? here can check code: int main() { const char *network = "255.255.255.0"; int n; inet_pton(af_inet, network, &n); int = 0; while (n > 0) { n = n >> 1; i++; } printf("network = %s, suffix = %d\n", network, i); }

awk - Fill empty columns with 0 -

i have file structure: 1 11827796 2 300 t:0.96 c:0.04 t 1 11827816 1 300 g:1 g for lines in file have 6 columns instead of 7, want insert 0 between 5th , 6th column have output: 1 11827796 2 300 t:0.96 c:0.04 t 1 11827816 1 300 g:1 0 g any idea on how can achieve awk. thanks lot in advance. here 1 solution: awk 'nf==6 {$5=$5" 0"}1' file |column -t 1 11827796 2 300 t:0.96 c:0.04 t 1 11827816 1 300 g:1 0 g if there 6 fields, add 0 , fix column width.

javascript - Clicking on thumbnail doesn't update main image -

$('#minipics img').click(function(){ var url = $(this).attr('src'); $('#mainpic img').attr('src', url); }); i have little code image gallery. want insert jquery tabs under gallery. so have html it: <div id="tabs"> <ul> <li><a href="#tabs-1">პროდუქტის აღწერა</a></li> <li><a href="#tabs-2">პრომო ვიდეო</a></li> <li><a href="#tabs-3">მსგავსი პროდუქტი</a></li> <li><a href="#tabs-4">კომენტარები (0)</a></li> </ul> <div id="tabs-1" class="ui-widget-content1"> <p>1</p> </div> <div id="tabs-2" class="ui-widget-content1"> <p>2</p> </div> <div id="tabs-3" class="ui-widget-content1"> <p>3</p> </div> <div id="tabs-4" class="ui-wi

c# - Prefix 0 in Razor Textbox value -

here razor text box @html.textboxfor(model => model.shortbufferhour,new { @maxlength = "2",style="text-align:center;"}) it shows hours 7 . how prefix 0 in case of single digit hour. textbox content 07 you need use d2 format option , pass value through html atttribute: this can done follows: @html.textboxfor(model => model.shortbufferhour, new { @maxlength = "2",style="text-align:center;", value=string.format("{0:d2}",model.shortbufferhour) })

c# - Web Api controller thinks it is duplicated -

i have webforms app, has web api controllers in integrations. 2 working fine. today wanted add controller. should simple enough, add new web api controller, add little bit of code it, and: namespace myapp.web.app_code { public class authexportcontroller : apicontroller { public ienumerable<string> get() { return new string[] { "value1", "value2" }; } } } and when call @ url : http://localhost:30978/myapp/api/authexport i error: <error> <message>an error has occurred.</message> <exceptionmessage>multiple types found match controller named 'authexport'. can happen if route services request ('api/{controller}/{id}') found multiple controllers defined same name differing namespaces, not supported. request 'authexport' has found following matching controllers: myapp.web.app_code.authexportcontroller myapp.web.app_code.

less - Bootstrap 3 mixin multiple make-*-column -

i'm using specific mixin trying make code more clear. instead of using: <div class="col-lg-3 col-md-5 col-sm-6 col-xs-12"> i'm using: <div class="stackoverflowrocksit"> and in mixins.less: .stackoverflowrocksit{ .make-lg-column(3); .make-md-column(4); .make-sm-column(6); .make-xs-column(12); } it works xs , sm viewports, not when resize md or lg (then taking sm size). proper way create columns different viewports sizes? idea? you should re-order mixin calls: .stackoverflowrocksit { .make-xs-column(12); .make-sm-column(6); .make-md-column(4); .make-lg-column(3); } @seven-phases-max right. bootstrap's code mobile first, mean should start code smallest screen widths , features , properties when screen size become wider. bootstrap use css media queries make css code responsive. in situation .make-lg-column(3); compiles css code shown below: @media (min-width: 1200px) { .stackove

ssl - Apple push notification service for MDM -

i've read tutorial apple push notification here due it, have provide app id identify application receive notification. in case of mdm server, receiver built-in client, value have put in field "app id" when register ssl certificate on question i've post, answered in case of mdm, field "topic" used built-in client receive notification. topic put in mdm payload server sent client. how server register field apns thank all, 1) don't go through usual push certificate creation route. what following you create csr apns request signging certificate you send apple , apple sign it, have apns request signing certificate each custom create apns csr , send you you sign apns request signing certificate you return apns csr customer the customer upload apple apple sign it now, customer has apns certificate the customer uploads mdm server all of these described in lengthy details in mdm protocol documentaion. 2)here how topic shared

java - unable to calculate itext PdfPTable/PdfPCell height properly -

i'm facing problem while trying generate pdfptable , calculate height before adding document. method calculateheights of pdfptable returned height lot greater height of page (while table 1/4 of page's height), wrote method calculate height: protected float getverticalsize() throws documentexception, parseexception, ioexception { float overallheight=0.0f; for(pdfprow currow : this.getpdfobject().getrows()) { float maxheight = 0.0f; for(pdfpcell curcell : currow.getcells()) { if(curcell.getheight()>maxheight) maxheight=curcell.getheight(); } overallheight+=maxheight; } return overallheight; } where getpdfobject method returns pdfptable object. using debugger i've discovered lly , ury coordinate difference (and height) of cell's rectangle bigger looks after adding table document (for example, 1 cell 20 , other 38 height while same on page). there nothing in cell except paragraph chunk in it: font f

java - How can I change TextBox in Excel with XSSF from Apache POI -

i using apache poi process excel file. excel file has 2 textboxes read text , change it. how possible xssf model? not want create new textbox- know how this. far trying, there no textbox anywhere there (that can see). xssfworkbook wb = //get workbook somehow xssfsheet sheet = wb.getsheetat(0); iterator<row> rowiterator = sheet.rowiterator(); while(rowiterator.hasnext()){ row row = rowiterator.next(); iterator<cell> celliterator = row.celliterator(); while(celliterator.hasnext()){ cell cell = celliterator.next(); } } for(packagepart pp : wb.getallembedds()){ } so textboxes? here's did obtain references textboxes , change contents in poi 3.10. for xssf (untested): xssfdrawing draw = sheet.createdrawingpatriarch(); list<xssfshape> shapes = draw.getshapes(); iterator<xssfshape> = shapes.iterator(); while(it.hasnext()) {

java - All maven modules and submodules are shown in the root tree list -

Image
this ide related question eclipse. i'm using version: luna release (4.4.0) integrated support maven. i'm wondering if it's possible have more structure in package explorer of eclipse. lets have following maven setup: + parent | + module 1 | | + domain | | + infra | | + domainimpl | + module 2 | | + domain | | + infra | | + domainimpl this valid maven structure. eclipse show every project/module in package explorer: + parent + module 1 + domain + infra + domainimpl + module 2 + domain + infra + domainimpl and of course not valid, since projects "duplicated". see following picture: is there way have eclipse correctly order modules correctly? because they're on filesystem: if import maven project can select change naming templates. can solve problem duplicate artifact names in projects.

Rails 3.2 will not update the time used in a query -

i have following code: @record = @user.records.where("question_group_id in (?)", @question_groups).ready.order(:next_ready).first the method "ready" scope: scope :ready, where("next_ready < :time", { time: time.now}) here's problem : i need algorithm run quite often. selects question present user. select right question :time in scope must correct. it's not. system seems reusing same :time on , on again. this not seem caching problem when empty cache , in case have setting in development: config.action_controller.perform_caching = false does know problem might be? the value of time.now being set when source file first read, must change scope use lambda reevaluated every query scope :ready, ->() { where("next_ready < :time", {:time => time.now}) }

batch file - Remove suffix from a directory's name -

a short foreword: working awkward setup; company have been contracted requires perform operations in batch, because of potential dangers of downloaded software , bureaucracy. have work purely in batch problem - no addins, downloads, or powershell suggestions please (:p). question: imagine directory containing directories, e.g., parent folder subfolder subfolder(1) subfolder(2) they've been uniquely reference such: parent folder ref231_subfolder ref527_subfolder(1) ref8837_subfolder(2) now want remove suffixes added prevent duplicate names! so, batch's rather challenging syntax string replacement, has proved quite issue. let me walk through code have, doesn't work, may of use: @echo off setlocal enabledelayedexpansion :: returns directories (/a:d), pipes findstr command, :: identifies prefix @ end of directory name. /f "eol=: delims=" %%f in ('dir /b /a:d ^| findstr ^.*^(*^)$') ( set f=%%f set suffix=^(!f:*^(=! echo

jenkins - Gallio not working with sonar-runner -

i'm trying sonar-runner run gallio , opencover on .net application. i've set following: sonarqube v4.3.2 gallio v3.4.14 nunit v2.6.3 opencover v4.5 sonar-runner v2.4 here have in sonar-project.properties file (the things conserning gallio) \#gallio sonar.gallio.mode= sonar.gallio.coverage.tool=opencover sonar.donet.visualstudio.testprojectpattern=*test* sonar.opencover.installdirectory=c:\\program files (x86)\\opencover\\ sonar.dotnet.test.assemblies=**\\bin\\debug\\*.tests.dll sonar.gallio.runner=local i have tried sorts of variations of config file weird thing when run sonar-runner, parameters -x or -e, there absolutely no mention of gallio or opencover in output. it's sonar runner skipping gallio section completely! does here have clue of might going on ? latest versions of c# plugin not support automatic execution of gallio (see this documentation ). starting c# 3.0, reuse of reports supported test , coverag

mysql - Unknown column 'lat' in 'field list' -

i'm tweaking wp_query quite lot add_filter function. i'm getting error wordpress: unknown column 'lat' in 'field list' the final sql output this: select sql_calc_found_rows wp_posts.*, ( 3959 * acos( cos( radians(52.486243) ) * cos( radians( lat ) ) * cos( radians( lng ) - radians(-1.890401) ) + sin( radians(52.486243) ) * sin( radians( lat ) ) ) ) distance , lat latitude , lng longitude wp_posts inner join wp_term_relationships on (wp_posts.id = wp_term_relationships.object_id) inner join wp_postmeta on (wp_posts.id = wp_postmeta.post_id) inner join wp_postmeta mt1 on (wp_posts.id = mt1.post_id) inner join lat_lng_post on wp_posts.id = lat_lng_post.post_id 1=1 , ( wp_term_relationships.term_taxonomy_id in (2) ) , wp_posts.post_type = 'event' , (wp_posts.post_status = 'publish') , ( (wp_postmeta.meta_key 'date_%_start-date' , cast(wp_postmeta.meta_value signed) <= '20140704')

SSAS 2005 MDX long running Query Failure error - The Operation Has been cancelled -

can please me in solving above mentioned error. new ssas , seeking expertise here. mdx query runs longer time (30 minutes) & throws error - server : operations has been cancelled. can please guide me in retrieving complete error details? log file stores error description? how read it? please me in resolving issue? in advance :)

ios7 - How to prevent preview image distortion when using cameraViewTransform -

i working custom uiimagepickercontroller, , scaling camera fit full screen follows: cgsize screensize = [[uiscreen mainscreen] bounds].size; float cameraaspectratio = 4.0 / 3.0; float imagewidth = floorf(screensize.width * cameraaspectratio); float scale = ceilf((screensize.height / imagewidth) * 10.0) / 10.0; self.picker.cameraviewtransform = cgaffinetransformmakescale(scale, scale); i access preview image using: uiimage *chosenimage = info[uiimagepickercontrolleroriginalimage]; the problem preview image has distortion , not same live camera view. how can fix this?

Iterating over a string in Perl -

i want make script type string letters 1 one my $str = 'test string'; @spl = split '',$str; (@spl){ print "$_"; sleep(1); } print "\n"; sleep() doesn't it's job! makes me wait more 1 second , im getting full text without delay. in loop, outputting 2 items. there fact output may buffered , therefore buffer may flushed , printed when \n gets sent. try setting $| non-zero value may disable line buffering. e.g $| = 1; $|++; // alternative seen alternatively, same thing: stdout->autoflush(1); # needs "use io::handle;" on older versions of perl although not issue here, sleep() not way of waiting second, on older systems. manual states, there reasons why sleep may take less or more 1 second.

date - SimpleDateFormat parsing in Android -

i trying parse date time string date object. however, keep getting wrong date dont know why. can me? my code looks this: simpledateformat dateformat = new simpledateformat("dd.mm.yy-hh:mm"); string test = serverentry.getstring("date") + "-" + serverentry.getstring("time"); string test2 = dateformat.parse(test).tostring(); an example run has these outputs: test = "27.06.14-12:18" // in 27th of june 2014, 12.18 (24-hours) test2 = "sat jun 27 12:06:00 cest 2015" mm specifies month of year , mm specifies minutes. need instead: simpledateformat dateformat = new simpledateformat("dd.mm.yy-hh:mm"); reference: http://developer.android.com/reference/java/text/simpledateformat.html

umbraco7 - Umbraco 7 fields show locally, but not at remote server? -

does know problem: new fields add work fine in local office, when use webmatrix publish server (discountasp.net) fields don't show up. did view source in browser , they're not there! for example, @umbraco.field("comments") thanks! daniel if add new field, added in database. means need update database on production website. webmatrix doesn't (by default). there few ways handle scenario: copy database production server (i advice against this, because might overwrite content , media changes on production server) create fields manually on production server (easy solution) use commercial package courrier (personally believe it's solution, if have content staging workflow) use free package usync ( http://our.umbraco.org/projects/developer-tools/usync )

mysql - i want to sent mail at a time all employees which is stored in my database using asp.net -

i have database in multiple records available. want pick record , sent mail employees how can do. solution of that. code below protected void btnsend_click(object sender, eventargs e) { //retrieve email addresses database. //i'm assuming table "members" , database "testdb" //on localhost. sqlconnection con = new sqlconnection("server=(local);database=testdb;uid=sa;pwd=yourpassword"); sqlcommand cmd = new sqlcommand(); cmd.commandtype = commandtype.text; cmd.commandtext = "select email members"; cmd.connection = con; datatable memberstable = new datatable(); sqldataadapter da = new sqldataadapter(cmd); con.open(); da.fill(memberstable); con.close(); //send email each recepient now. mailmessage msgmail = new mailmessage(); foreach (datarow row in memberstable.rows) { msgmail.to.add(row["email"]); } msgmail.from = "webmaster

json - Parse response and response headers PHP -

i'm working on app supposed status , date account created. have response (in json format) can't seem parse neither response nor response headers. don't show echo. extract 2 variables of response , since response header delivers cookie, , store next response. here response received: http/1.1 100 continue http/1.1 200 ok date: fri, 27 jun 2014 14:28:38 gmt server: apache set-cookie: ci_session=one_very_long_cooooookie; expires=fri, 27-jun-2014 16:28:38 gmt; path=/ status: 200 content-length: 304 content-type: application/json { "success": true, "user": { "user_id": "2k287as952", "username": "myusername", "requesting_ip": "123.456.789.012", "account_created_at": "2012-08-13 15:57:35", "online_status": "1", "auth_token": "26cc3bcf-2cb5-a90e-b1c

python - Why my using memo didn't raise the efficiency at all? -

i doing exercise in think in python, using memo calculate fibonacci sequence far more efficiency not using one. when implemented , testing time consumed, find running time not reduced @ all. know there wrong program, please tell me went wrong. many thanks. import time known = {0:0,1:1} def fibonacci_memo(n): """return nth number of fibonacci sequence using memo raise efficiency""" if n in known: return known[n] res = fibonacci(n-1) + fibonacci(n-2) known[n] = res return res def fibonacci(n): """return nth number of fibonacci sequence without using memo""" if n == 0: return 0 if n == 1: return 1 return fibonacci(n-1) + fibonacci(n-2) if __name__ == '__main__': start = time.clock() print fibonacci_memo(32) elaspsed = time.clock() - start print 'using memo time used: ' + str(elaspsed) start = time.clock() print f

How to implement "last seen at" functionality (like whatsapp) in XMPP? -

i working on chat application , want add "last seen at" functionality. trying implement using presence stanzas getting 1 issue, please check @ below link not getting unavailable presence of user when user b unavailable is there other way implement last seen @ functionality please suggest the first google result "xmpp last seen" xep-0012: last activity , protocol extension can used find out when user online last time. you send request this: <iq from='romeo@montague.net/orchard' id='last1' to='juliet@capulet.com' type='get'> <query xmlns='jabber:iq:last'/> </iq> and response this: <iq from='juliet@capulet.com' id='last1' to='romeo@montague.net/orchard' type='result'> <query xmlns='jabber:iq:last' seconds='903'/> </iq> which means contact last online 903 seconds ago. subtract current ti

c++ - Issue with opening COM Port -

in order read data bluetooth device(a disto), device gets paired pc ,by using pair code, , below code used open specific com port: port.format(str("\\\\.\\com%d"),m_distoserialport); createfile(port, generic_read | generic_write, 0, 0, open_existing, file_attribute_normal, 0); it works without problem in every version of windows , kind of device(disto). in windows 8(and 8.1) when comes line little message pops @ right corner of screen saying "adding device. tap set disto xxxx" , fails connect , code returns "e_accessdenied general access denied error". also, again execution @ method, "allow device connect"(in bluetooth icon on taskbar) gets enabled. while in windows 8 clicking on no help, in windows 7 asks pair code again , createfile method works fine. does mean device isn't paired although paired? problem opening port or making connection? does know what's going wrong here? thanks. edit: if remove generic_read or gene

jquery - Simple fadeOut() working erratically as ajax callback -

this driving me mad! i can't figure out why fadeout() function not working here. i'm sure it's going annoyingly simple, can't see it. when trigger button clicked, first fadeout() works fine - #page3 fades out expected , #holdingpage fades in. however, once ajax call completed #holdingpage div not fade out, #thankspage div fade in, i'm left contents of both #holdingpage div , #thankspage div. ajax call working fine - form submitted , data written database via php script. can help?! here code: html <div id="page3" class="surveydivs"> ...blah...blah...blah... </div> <div id="holdingpage" class="surveydivs" style="display: none;"> <div class="loadingdiv"> <img class="loadingimage" src="../css/ajax-loader.gif" /> </div> </div> <div id="thankspage" class="surveydivs" style="display: none;"

Excel VBA - Copying non-adjacent range to a different non-adjacent range -

i'm looking run through loop of data , copy across cells 1 sheet another. using "longhand" can following work : sub update() dim template worksheet: set template = worksheets("importtemplate") dim master worksheet: set master = worksheets("master") dim long, x long master = 2 .range("a" & rows.count).end(xlup).row select case .range("a" & a).value case "s" x = template.range("a" & rows.count).end(xlup).row + 1 template.range("a" & x).value = .range("e" & a).value 'site details template.range("b" & x).value = .range("ao" & a).value 'meter details case "m" case "c" case else end select next .select end end sub is there "better" way of doing ? there far more cells update it's not limited 2 shown example you inclu

java - detect if a market:// link is clicked in a webview -

i try execute code after link clicked in webview. normal links http:// managed using shouldoverrideurlloading method , view.loadurl(url); but links starting market:// redirect googleplay app, doesn't work. loadurl("market://") throws url not found error. how can detect if market:// link clicked in webview ? my code: wvinfo.setwebviewclient(new webviewclient() { @override public boolean shouldoverrideurlloading(webview view, string url) { if (url.startswith("http")) { view.loadurl(url); // works return true; } else if (url.startswith("market:")){ <do special> view.loadurl(url); // doesn't work return true; } } }); you detect if market:// link clicked, code right. your question how call googleplay app? use intent instead of loadurl: intent intent = new intent(intent.a

sql - Join on multiple tables where table column has mixed values -

hy guys! last few days i've been searching s solution on web , so. it's first question please patient :) before explaining apologize if simple, i've tried think of , i've got nothing. so, let's start :) the problem in t3_access.auth_id there values user_id , group_id, need write query list users listed in t3_access.auth_id column , users behind group in t3_access.auth_id. is possible distinguish between users connected user_id or group_id in query? more welcome. here sqlfiddle link: http://sqlfiddle.com/#!2/b6dd7/5 i have 4 tables structure: t1_users (user_id, name, pwd_opts) t2_connections (user_id, group_id, conn_opts) t3_access (auth_id, class_name, gr_name) t4_groups (group_id, group_name) here sample data: create table t1_users ("user_id" varchar2(10), "name" varchar2(10), "pwd_opts" varchar2(10)); create table t2_connections ("user_id" varchar2(10), "group_id" varchar2(10), "conn_opts&