Posts

Showing posts from January, 2010

jquery - lazy-loading doubleclick ads versus enableSingleRequest() -

in attempt increase active in-view metrics, i'm trying defer display ad call ( googletag.display('ad-' + adlocation) ) wrapping in 'in-view' check (using jquery.inview), seems work if disable googletag.pubads().enablesinglerequest(); correct in understanding enablesinglerequest() overriding calls googletag.display ? to clarify, enablesinglerequest necessary in order serve guaranteed roadblocks, need ensure ads being served when in-view. possible? at face value, no. what render different blocks of ads different single requests, render road-blocked slots together, , other ads @ other times. the problem that, far know, dfp resets correlator every 30 seconds, if don't use single requests, risk losing roadblocks, depend on correlator know they're part of same request. another tactic try wait 25 seconds or render below-the-fold ads; still rendered within same correlator time, ensuring roadblock, if user closes window before that, ad doe...

javascript - Limiting function to drawing only once when clicking -

i have click event needs run function once, have propagating each time click mouse. know it's because event looking each time images on canvas clicked, how make detect 1 click event run particular function? need make entirely separate click event? $("#schematic_holder").on("click", function(ev){ var x = ev.pagex; var y = ev.pagey; for(var img in images){ var img_x = images[img].dest_x; var img_y = images[img].dest_y; var img_w = images[img].width; var img_h = images[img].height; if((x > img_x) && (x < img_x + img_w)){ if((y > img_y) && (y < img_y + img_h)){ this function want call once have created infinite loop, don't want. if(images[img].name == "landing gear handle"){ drawimages(images[img].src, images[img].name, images[img].position_2.x, images[img].position_2.y, images[img].width, images[img].height, image...

python - passing multiple instances of the same class through objects -

class card: allranks=(2,3,4,5,6,7,8,9,10,11,12,13,14) allsuits=('spades','hearts','diamonds','clubs') def __init__(self, rank, suit): self.rank=rank self.suit=suit.capitalize() def getrank(self): if self.rank in card.allranks: return self.rank else: print 'please enter number 2 14\n14 => ace\n11 => jack\n12 => queen\n13 => king\n' exit() def getsuit(self): if self.suit in card.allsuits: return self.suit else: print 'there 4 suits in pack!' exit() def __str__(self): translate={11:'jack',12:'queen',13:'king',14:'ace'} r = self.rank if r in range(11,15): myrank=translate[r] elif r in range(2,11): myrank=str(r) else: print "sorry wrong card" exit() return myrank+' of '+self.suit def __lt__(self,other): return (self.rank > other.getrank()) ...

groovy - Is there a way to run delayed or scheduled task with GPars? -

i'm building concurrent application on top of gpars library. contains thread pool under hood, solve concurrency-related tasks means of pool. i need run task delay (e.g. 30 seconds). want run tasks periodically. are there ways implements these things gpars? what thread.sleep delaying , quartz scheduling? know there obvious choices don't see wrong using them. what mean mix gpars bit of higher order closures e.g.: @grab(group='org.codehaus.gpars', module='gpars', version='1.2.1') def delaydecorator = {closure, delay -> return {params -> thread.sleep (delay) closure.call (params) } } groovyx.gpars.gparspool.withpool() { def closures = [{println it},{println + 1}], delay = 1000 closures.collect(delaydecorator.rcurry(delay)).eachparallel {it (1)} }

Angularjs loading Google Api -

i'm having issue using google api in angularjs 1.3 (spa using ui.router). per google api instructions, added reference client.js file call in index.html head, <html ng-app="myapp"> <head> <script src="scripts/jquery-2.1.3.min.js"></script> <script src="scripts/angular.min.js"></script> <script src="scripts/angular-ui-router.min.js"></script> <script> function loadgapi() { } </script> <script type="text/javascript" src="https://apis.google.com/js/client.js?onload=loadgapi"></script> as understand, client.js asynchronously load full client api, , when complete call defined function loadgapi. sometimes loadgapi called before angular app .run called, , not. don't mind loads asynchonously.. how can alert angular app indeed ready use? i faced sim...

Trying to validate a piece of HTML -

i'm trying following validated, fails: <li> <a href="#" title="some title"> <div class="some class"> <img src="http://somepathtoimage.com" alt="some alt text" /> </div> <h3 class="some class">some text</h3> </a> </li> <div> tags should never placed inside <li> tags, worse inside <a> tags. change <div> , <h3> <span>

xml - Advanced boolean search of JSON files containing speech-to-text data? -

i have hundreds of automatic machine transcripts of video , audio files. have every transcript in 5 formats: json, xml, srt, vtt, txt. (click here see example files.) json , xml files contain comprehensive data, including speaker id, confidence level, , timecodes. i looking way mine or search data find words , phrases. need able submit boolean search query, click result , play video/audio file @ timecode of text result . necessary boolean operators not, and, or (just online search engine). example search: ("baseball bat" , park) or soccer i'm thinking of simple interface. basic options: search box minimum confidence level slider ideas advanced options: speaker: "bob,joe,bill" (that is, speaker must 1 of these) maximum time allowed between words in , search: x.x seconds maximum time allowed between words in exact phrase search: x.x seconds words in exact phrase search must have same speaker: on/off words between , must have same spe...

Connection Refused in WearableListenerService / Android Wear when phone in sleep mode -

i developing android wear watchface accesses internet sending messageapi request wear mobile app, running wearablelistenerservice, , on mobile app, receive request wear in onmessagereceived, , in onmessagereceived start asynctask retrieve image internet. this works fine normally . however, if phone inactive few minutes (screen black, not connected mac via usb) receive "econnrefused - connection refused server", when asynctask tries retrieve inputstream on line: inputstream = (inputstream) new url(murl).getcontent(); here exception: java.net.connectexception: failed connect dl.dropboxusercontent.com/xx.xx.xxx.xx (port 443): connect failed: econnrefused (connection refused) @ libcore.io.iobridge.connect(iobridge.java:118) @ java.net.plainsocketimpl.connect(plainsocketimpl.java:192) @ java.net.plainsocketimpl.connect(plainsocketimpl.java:460) @ java.net.socket.connect(socket.java:838) @ com.android.okhttp.internal.platform.connectsocket(platform.java:131) @ com.and...

How do I include an external JavaScript file when serving an HTML file with a response object in expressjs? -

my express app serves html page disk upon initial (i.e., if hit " http://localhost:3000/ " in browser). access javascript file in same location in disk html file. when try include in 'index.html' using <script src="/myjavascriptfile.js" type="text/javascript" ></script> or <script src="./myjavascriptfile.js" type="text/javascript" ></script> or <script src="~/myabsolutepath/myjavascriptfile.js" type="text/javascript"</script> it doesn't work. myjavascriptfile.js file never reached. my express app looks this: var express = require('express') var testmethod = require('./test') var app = express() app.use(bodyparser.urlencoded({ extended:false })); var server = app.listen(3000, function () { var host = server.address().address var port = server.address().port console.log('example app listening @ http://%s:%s', host, po...

Load text Files to python weka wrapper -

i've installed weka python wrapper on windows 7. , tried running sample code: import weka.core.jvm jvm jvm.start() data_dir = "e:/files/fourth/" weka.core.converters import loader loader = loader("weka.core.converters.textdirectoryloader") datasets = [ data_dir + "file 1", data_dir + "file 2", data_dir + "file 3", data_dir + "file 4", data_dir + "file 5" ] data = loader.load_file(datasets) data.delete_last_attribute() print(data) and received following error: traceback (most recent call last): file "c:/python27/weekaa.py", line 16, in <module> data = loader.load_file(datasets) file "c:\python27\lib\site-packages\weka\core\converters.py", line 67, in load_file self.enforce_type(self.jobject, "weka.core.converters.filesourcedconverter") file "c:\python27\lib\site-packages\weka\core\classes.py", line 155, in enforce_type ...

android - How can I tell MyCountDownTimer to quit whenever a certain activity isn't opened? -

the project i'm working on quiz timer on each question. 30 seconds. noticed if finish test before timer runs out, timer doesn't stop running. if head on test, notification haven't finished test popup , overide current activity. here mycountdowntimer class public mycountdowntimer(textview textcounter, long millisinfuture, long countdowninterval) { super(millisinfuture, countdowninterval); this.textcounter = textcounter; } @override public void ontick(long millisuntilfinished) { textcounter.settext(string.valueof(millisuntilfinished / 1000)); } @override public void onfinish() { intent retryintent = new intent(textcounter.getcontext(), retry.class); if (textcounter.getcontext() instanceof test1){ whichtest = 1; retryintent.putextra("whichtest",whichtest); } if (textcounter.getcontext() instanceof test2){ whichtest ...

ios - How to populate a UIPickerView with results from a NSFetchRequest using Core Data -

i have uipickerview trying populate results nsfetchrequest pulling data managedobjectcontext. when initialize uipickerview following, kcmodalpickerview *pickerview = [[kcmodalpickerview alloc] initwithvalues:_usernames]; xcode doesn't throw , warnings or errors, when build , run app getting following error. * terminating app due uncaught exception 'nsinvalidargumentexception', reason: '-[account copywithzone:]: unrecognized selector sent instance 0x7a60ec70' * first throw call stack: now before error due me not implementing copywithzone method in vc, want point out in class files using keyword copy the method told causinging crash belongs kcmodalpicker class implementation file. , method looks following, // edit method - (nsstring *)pickerview:(uipickerview *)pickerview titleforrow:(nsinteger)row forcomponent:(nsinteger)component { return [self.values objectatindex:row]; } what need change / edit / add prevent app crashing? update _username...

android - How do I get my GridView top row to match the height of the tallest item? -

i have gridview multiple view types. reason height of top row matches shortest item, taller items truncated @ bottom. is there way tell gridview make sure every item fits in row? have control on height of individual rows? how gridview decide how tall row should be? p.s. didn't post code sample because i'm pretty sure problem isn't specific code. in fact think may bug in gridview since happens in first row. it seems gridview uses first child measure height of row this might best bet.. gridview rows overlapping: how make row height fit tallest item?

search - Netsuite getting the display text for a formula -

i in need of getting text (display) value of field compare date ranges on posting period. have formula below pushing in filter array other filters need run var columns = []; columns.push(new nlobjsearchcolumn('transactionnumber')); columns.push(new nlobjsearchcolumn('line')); columns.push(new nlobjsearchcolumn('item')); columns.push(new nlobjsearchcolumn('account')); columns.push(new nlobjsearchcolumn('amount')); columns.push(new nlobjsearchcolumn('vsoeallocation')); columns.push(new nlobjsearchcolumn('postingperiod')); columns.push(new nlobjsearchcolumn('srctranpostperiod','revrecschedule')); columns.push(new nlobjsearchcolumn('recuramount','revrecschedule')); columns.push(new nlobjsearchcolumn('jedoc', 'revrecschedule')); columns[0].setsort(); columns[1].setsort(); var filter = []; var formula = "case when to_date({postingperiod.displayname}, ...

C++ Pre-fix and Post-fix operator overloading for addition (+) (not ++ or --) -

this question has answer here: what basic rules , idioms operator overloading? 7 answers i writing complex class assignment in 1 of methods should overload default addition operator when adding double complex number. far, have following code correctly works c+5 c complex object complex& complex::operator+(const double& d) const { return complex(real + d, imag); } however, doesn't when 5+c . think might because of prefix post-fix thing not sure. my question if there way overload + operator can 5+c . tried searching solution online answers find dealt increment/decrement operators add int argument post-fix. tried same thing + doesn't work. thank much. two options come mind: 1) implement 2 non member functions: complex operator+(const complex& lhs, double rhs); complex operator+(double lhs, const complex& rhs); 2) ...

Ruby Rack app reverse proxy with Nginx -

are there link/resources deploying rack app(not rails!). so far have rack app set-up folders , such have been having lots of trouble nginx part uninstalled , decided try again. maybe here give me dumbed-down version task? thanks in advance at point, guide rails 3 , should work other rack app. guides setting passenger, unicorn, thin or puma should work fine rack app.

javascript - How to send mail confirmation after signup in Cakephp 2 -

hello want send mail after signup , have problem , userscontroller : public function add() { if ($this->request->is('post')) { $this->user->create(); if ($this->user->save($this->request->data)) { $link = array('controller'=>'users','action'=>'activate', $this->user->id.'-'.md5($this->request->data['user']['password'])); app::uses('cakeemail','network/email'); $mail = new cakeemail(); $mail->from('dafhermcslama@gmail.com') ->to($this->request->data['user']['email']) ->subject('test :: inscription') ->emailformat('html') ->template('signup') ->viewvars(array('username'=>$this->request->data['user']['username'], 'link'=>$link)) ->send(); $this->session->setflash(__('the user has been s...

javascript - Remove "checked" from radio when a checkbox is unchecked -

i have checkbox ( #fbmngch ) reveals set of radio buttons ( name=admanage ) when clicked. when checkbox unclicked, radio button selected still remains checked. have checked status of radio button removed once checkbox unchecked. this being used in form, if user changes mind selecting service, details service wiped (so value of selected radio not end in php , email). hope makes sense. i have given considerable time , not seeming work correctly. last set of if-statements part of code wrote. not sure if missing something, selecting wrong, or what. highly appreciated. thanks! html <li> <input type="checkbox" class="cbox" name="fbchecks[]" value="facebook ad mgmt" id="fbmngch"> <label for="test">facebook ad management</label> <ul id="fbmnglist"> <li> <input type="radio" name="admanage" value="ad management 1...

android testing - Are beta only apps visible in Google Play Store -

i'm launching new app , have tried take steps release beta versions of app (prior actual launch in google play store). here have done far. 1. uploaded beta apk 2. filled out enough meta data portal allows me 'publish' app, have no production apk, beta apk. 3. created google group testers joined , have linked google group beta list. so question is, realize members of google group i'm using testing must logged play store same account joined testing google group with. assuming logged play store correct account on device, should able see beta app in play store? the link developer portal entitled 'view in play store' errors out message 'we're sorry, requested url not found on server.' makes sense me app has no production apk @ point (this run desk top, not device). so question is, how should testers find build install or indication i've missed step in prepping apk beta distribution. so pretty clear after sorting through documen...

c# - Get total Amount of the column in AngularJs -

i working on project wherein need sum of column in modal table. yes, calculates amount decimal point not included. (e.g expecting result 194,000.26 result shows 193,000.00) means didn't add decimal point. can me codes ?? here view : <tr data-ng-repeat="model in models | orderby: sorting:reverse | filter : filter "> <td>{{jsondatetotext(model.requestdate) | date:'mm/dd/yyyy'}}</td> <td> <a href="#" data-toggle="modal" data-target="#basicmodalcontent" data-ng-click="getselectedpr(model)"> {{model.requestid}} </a> </td> <td>{{model.number }}</td> <td>{{model.programname }}</td> <td>{{model.fullname }}</td> <td>{{model.pono...

java - How to create a single drawingpanel that uses multiple classes to create graphics -

i looking starting point, not answer, more trying understand concept. how windows on 1 panel/window? creates facebookperson : public class facebookperson{ private string myname; protected string mymood; protected facebook myfacebook; public facebookperson(string name){ myname = name; myfacebook = new facebook(myname); //system.out.println("facebookperson_graphics's constructor"); } public facebookperson(){ } public string getname(){ return myname; } public void setmood(string newmood){ mymood = newmood; myfacebook.setcontent(mymood); } public string getmood(){ return mymood; } } this code creates , edits: package facebook; import java.awt.*; public class facebook{ private string name; private string content; drawingpanel panel; private graphics g; public facebook(string nm){ content = "undefined"; name = nm; // create drawing panel panel =new drawingpanel(200,150); g = panel.getgraphics(); // display name ...

ruby on rails - generate activerecord schema from an existing table -

does know of way this? i have existing table created sql , create schema reproduce table (minus data) edit config/database.rb point database want copied. rake db:schema:dump create blank migration copy relevant create_table lines schema dump , paste migration file manually insert migration timestamp schema_migrations table (this applies existing setup has relevant table)

python - Pygame error, I have no clue what's happening -

i'm attempting pygame 1.9.2 python 3.4.3, , giving me error don't understand @ all. code basic hello world: import sys import pygame pygame.locals import * pygame.init() displaysurf = pygame.display.set_mode((400, 300)) pygame.display.set_caption('hello world!') while true: event in pygame.event.get(): if event.type == quit: pygame.quit() sys.exit() pygame.display.update() here's error i'm getting: 2015-03-16 22:41:23.073 python[71068:8424090] *** terminating app due uncaught exception 'nsinternalinconsistencyexception', reason: 'error (1000) creating cgswindow on line 281' *** first throw call stack: ( 0 corefoundation 0x00007fff8c69364c __exceptionpreprocess + 172 1 libobjc.a.dylib 0x00007fff93ede6de objc_exception_throw + 43 2 corefoundation 0x00007fff8c6934fd +[nsexception raise:format:] + 205 3 appkit ...

datetime - How to describe repeating intervals which has an unfixed time interval in ISO 8601? -

for example, time format has fixed time interval, can describe " 30 9 * * * "(crontab time format) " r/2015-03-01t09:30:00-06:00/p1d " in iso 8601 . but how can describe " 10 2,4,6,8,10,14,18,22 * * * " (which has unfixed time interval) in iso 8601? thanks lot!

mysql - Seen logic for Social site function -

i'm making social site , i'm confused logic seen function. here seen table __________________________________ |seen_id|seen_notif_id|seen_viewers| ---------------------------------- | 1 | 1200 | 352,1,444 | with table seen_notif_id column comes notif table all user actions being added notif table , trigger function inside database after insert in notif table added seen table. for seen_viewers column. if user clicks notification specific id of notification, update column , add user_id. have stock procedure inside database can reverse concat seen_viewers column verify if seen notification id. this way if user viewed particular post/comments/tags/etc . is okay implement? making table unnotify? that not way @ all. read tutorials on database normalization. if want track saw what, not keep comma-seperated list of ids: make seperate table each id seperate row. basic database design. research one-to-many , many-to-many relationships see how...

mockito - Is there any way to mock field of Class -

here's case, have class has 1 member field b. , want test , in unit test, mocked , need call method f() invoke b's f(). b variable in mocked null, throw npe, , have no get/set method b, there way mock b ? thanks public static class b{ public void f() { } } public static class { b b; public void f() { b.f(); } } if want mock out b property of in test, you've given b property default (package-private) access, long test in same package replace b property directly. @test public void testb() { undertest = new a(); b mockedb = mockito.mock(b.class); undertest.b = mockedb; undertest.f(); mockito.verify(mockedb).f(); } as aside, dislike using package-private access mess around member properties tests, , instead recommend dependency injection framework guice or spring di constructor injection. however you've described you've mocked out a, i'd have thought if case f() method of nothing - wou...

ruby - Is there any way to encode the URL at runtime in rails? -

in rails application, have search functionality. user may directly enter search string in url. if user enters search string '%' , url becomes: http://localhost:3000/search/% and produces bad request error. there option encode url @ runtime? the question you're asking wouldn't solve problem you're describing. yes, rails can encode url @ runtime, in fact encodes many urls @ runtime in normal operation. but, won't you, what's happening when users create url % in it, they're creating invalid url - not rails, web server, or web application server or framework. if closely @ error returned in browser, it's not rails, it's webrick (or whatever httpd you're using), same error logged logs, it's not normal rails error in routing or elsewhere. the upshot of no, can't handle in rails because in many cases won't through rails, , it's totally invalid url.

android - Is it my appliction causing freezing and restarting the phone? -

first of all, if it's not right place ask question, please guide me. recently users of application complaining phone freezes , restarts while using app. question how can app freeze android os? there chance that? if yes, possible causes behind it? how can isolate issue? (one of user uses device sm-g900v, android os 5.0) in debug mode ran app , continuously used it, , found thead count not coming down , gradually increasing ,i noted thread names. used ddms in used update thread option , checked thread getting created. in case media related thread not getting released(its system thread). made sure gets released time . boom problem solved :)

how to store Multiple pattern parameter in variable and print ihe values of that variable in JavaScript -

i have str variable in string there var str = "the 1_raj in spain stays mainly 3_raj in 1_raj the plain 2_raj 4_raj 6_raj _ 1_raj "; var res = str.match(/1_raj/g); i want store( 1_raj,2_raj,3_raj,4_raj,...etc ) in res variable can diffirent(1_raj,2_raj,3_raj,...) values in variable res thanks use regular expression result, var res = str.match(/[0-9]{1}_raj/g); to match 0_raj , 1_raj , .. 9_raj change value bracket if value more 9 10_raj var res = str.match(/[0-9]{2}_raj/g); now can use separate values looping through array 'res'. for(var = 0; < res.length; i++) { alert(res[i]); // here each value separately, want. } hope works. thanks.

c++ - Windows - only the first entry of PATH-environment variable can be found -

the following problem path-environment variable have time, , it's become untolerable annoying appreciate lot. the following content of system environment variables, output of echo %path% on cmd-exe. c:\mingw\bin; c:\program files (x86)\microsoft visual studio 12.0\vc\bin; c:\msys\1.0\bin; c:\qt\5.3\msvc2013_64\bin; c:\users\public\documents\embarcadero\studio\15.0\bpl;c:\program files (x86)\embarcadero\studio\15.0\bin64;c:\users\public\documents\embarcadero\studio\15.0\bpl\win64;c:\program files\doxygen\bin;%ant_home%\bin; %java_home%\bin; %m2_home%\bin; c:\program files (x86)\miktex 2.8\miktex\bin; c:\program files\pdf split , merge basic\bin; c:\program files\microsoft\web platform installer; c:\program files (x86)\microsoft asp.net\asp.net web pages\v1.0\;c:\program files\microsoft sql server\110\tools\binn;c:\program files (x86)\windows live\shared;%systemroot%\system32;%systemroot%;%systemroot%\system32\wbem;%systemroot%\system32\windowspowershell\v1.0\;c:\program file...

email - (php) Does mail() save the "sent mail"? -

i use mail() in php send mails. i don't know mail() , have send mail without saving mails sent. in general mailing service such gmail, there "sent" page displays mails sent. (after log in, can access via here ) it means google saves mails sent in db. mail() save too? if does, how can not save? no, php mail() function contacts directly configured (possibly local) mail server forwards destination. saving e-mails in sent folder application (google mail, thunderbird, outlook) explicitely you. if want save mail in google account, need kind of imap library save mail or send every mail in bcc account , create filter automatically move them sent folder.

Python SQLite3 Commit() invalid error -

new python , first time using sqlite3. i followed online walk thru of how use basics of sqlite. i'm trying improve current csv storage proper database , seems simple enough. my problem when try , commit() spider says invalid syntax. searched answer seems folks have different version of error. double checked brackets , think have them correct. can please lend second set of eyes , tell me i've missed? below of code. omitted parts serial port init stuff. can post if needed. the basic idea of code reads gps puck , parses nmea sentences stores them in database along rssi level i'm pulling radio. data_log can see being printed on screen in case crashes. def init_file(): filename = raw_input('enter save file:') global db db = sqlite3.connect('rssi_data/'+filename) init_file() cursor = db.cursor() cursor.execute(''' create table users(id integer primary key, tod blob,lat real,long real,alt real,qual real,re...

wso2 - Error while adding the API [AM 1.8] -

when creating api logged in apicreator instruct in doc , @ end of 3rd step gives error saying error while adding api- test-1.0.0 , server log attached below. tried locally , worked out problem. happens when doing using server running in ec2 instance. any how though error comes api created when tried update @ implement stage same happens , can't manage state update: environment: java version "1.7.0_75" java(tm) se runtime environment (build 1.7.0_75-b13) java hotspot(tm) 64-bit server vm (build 24.75-b04, mixed mode) wso2 1.8 server log: [2015-03-17 07:45:42,796] error - add:jag org.mozilla.javascript.wrappedexception: wrapped org.wso2.carbon.apimgt.api.apimanagementexception: error while adding api- mockapi-1.0.0 (/publisher/modules/api/add.jag#50) @ org.mozilla.javascript.context.throwasscriptruntimeex(context.java:1754) @ org.mozilla.javascript.memberbox.invoke(memberbox.java:148) @ org.mozilla.javascript.functionobject.call(functionobje...

c# - How to find closest point (point being (x,y), in a list of different points) to a given point? -

currently have random point being generated random. trying check if given random point close other existing points in plane, if far enough away other points, added list of other points. start 1 given point , first hundered points in list being generated way. problem is, when go draw points on list onto screen, points closer should allowed be. public void generatefirstmap() { int count = 0; { int randxpixels = main.rand.next(24, main.screenwidth - 16); //leave outer 16 pixels of screen empty (planet sprite has diameter of 8 pixels) int randypixels = main.rand.next(27, main.screenheight - 27); tuple<int, int> coord = tuple.create(randxpixels, randypixels); if (distance(closestpoint(coord), coord) < 200) { continue; } points.add(coord); //list<tuple<int,int>> points; count++; } while(count < 100); public tuple...

android - Control Thickness of ProgressBar -

Image
i have progress bar shown below: question v simple, how control "thickness" of circular view seems thick in opinion. in advance. use bar style style="?android:attr/progressbarstylelarge"

MongoDB: Slow query, even with index -

i have webpage, uses mongodb storing , retrieving various measurements. suddenly, in point, webpage became sluggish became unusable. turns out, database culprit. i searched , have not found solution problem, , apologize, pretty new mongodb , pulling hair out @ moment. version of mongodb using 2.4.6, on vm machine 20gb ram, runs ubuntu server 12.04. there no replica or sharding set up. firstly, set profiling level 2 , revealed slowest query: db.system.profile.find().sort({"millis":-1}).limit(1).pretty() { "op" : "query", "ns" : "station.measurement", "query" : { "$query" : { "e" : { "$gte" : 0 }, "id" : "180" }, "$orderby" : { "t" : -1 ...

javascript - Jdewit Timepicker show widget on text and icon click -

i want widget show when click textbox. how can achieve ? using jdewit timepicker here code html <div class="input-append bootstrap-timepicker"> <input id="timepicker1" type="text" class="input-small/> <span class="add-on"><i class="icon-time"></i></span> </div> jquery: $('#timepicker1').timepicker({ minutestep: 15 }); i manage archive using .trigger here code html <div class="input-append bootstrap-timepicker"> <input id="timepicker1" type="text" class="input-small/> <span class="add-on"><i class="icon-time"></i></span> </div> jquery: $('#timepicker1').timepicker({ minutestep: 5 }); $('#timepicker1').on('click', function(e) { $(this).next().trigger('click'); }) ;

c# - Checking if a user is in a role in asp.net mvc Identity -

Image
i'm having issue seeding database users , roles. the user , role both created (i can see them in database after error thrown). however, when try check if user in role, exception. my code is: public class tbinitializer<t> : dropcreatedatabasealways<tbcontext> { protected override void seed(tbcontext context) { applicationdbcontext userscontext = new applicationdbcontext(); var userstore = new userstore<applicationuser>(userscontext); var usermanager = new usermanager<applicationuser>(userstore); var rolestore = new rolestore<identityrole>(userscontext); var rolemanager = new rolemanager<identityrole>(rolestore); if(!userscontext.users.any(x=> x.username=="marktest")) { var user = new applicationuser { username = "marktest", email = "marktest@gmail.com" }; usermanager.create(user, "pa$$w0rd!"); ...

javascript - jQuery setting & getting localstorage data for dropdowns & input's -

i'm trying make simple form page have localstorage functionality restore settings/input after page has been closed/reloaded. i've attempted make start still learning there mistakes , can't work. if change made name input field should update localstorage new name. if change made of dropdown (selector? option?) fields should update localstorage new value. on page load should automatically restore of values. the "clear" button should only reset dropdown (selector? option?) fields blank, should not reset name field. example: https://jsfiddle.net/5gam3b6f/ $(document).ready(function () { $.each($("select"), function (index, value)) { localstorage.getitem($(this).attr(“id”)); }; }); $("select").on("change", function () { localstorage.setitem($(this).attr(“id”), $(this)); }); i haven't managed start on name input field or clear function yet because can't first 1 work. i rather not use ext...