Posts

Showing posts from August, 2012

ios - configure UICollectionView cell on initial lookup -

i getting cells uicollectionview calling dequeuereusablecellwithreuseidentifier: . want set specific configuration information first time cell returned method , not subsequently when gets reused. there hook somewhere can run "one time" code on collection view cells? obviously set information every time or use boolean keep track of whether or not cell has been initialized, i'd know if there's cleaner way first. this easy enough within cell's implementation there's no convenient way data source differentiate newly created vs reused cells. if configuration must supplied data source data source need check if cell has been configured already. the cells created once can use init or awakefromnib set initial state. cells have prepareforreuse called when being reused allowing perform changes need make per-use.

c++ - linked list and file Handling -

i have tried write , read linked list in file couldn't succeed. file written program cannot read linked list file. this code: case 2: temp = first; while (temp != null) { temp->output(temp); temp = temp->next; } break; case 3: // write in file fstream file; file.open("group.dat", ios::app | ios::out | ios::in | ios::binary); { temp = first; while (temp != null) { file.write(reinterpret_cast<char*>(&temp), sizeof(user)); temp = temp->next; } } exit(-1); case 4: // read file fstream file; file.open("group.dat", ios::app | ios::out | ios::in | ios::binary); file.seekg(0); while (!file.eof()) { file.read(reinterpret_cast<char*>(&temp), sizeof(user)); }

hive - Create external table with select from other table -

i using hdinsight , need delete clusters when finished running queries. however, need data gather survive day. working on queries create calculated columns table1 , insert them table2. first wanted simple test copy rows. can create external table select statement? drop table if exists table2; create external table table2 select * table1 stored textfile location 'wasb://{container name}@{storage name}.blob.core.windows.net/'; yes have seperate 2 commands. first create external table fill it. create external table table2(attribute string) stored textfile location 'table2'; insert overwrite table table2 select * table1; the schema of table2 has same select query, in example consists of 1 string attribute.

Adding A Radio Button To Rails App -

i'm trying add radio button "accounts" form. however, when selecting radio button on form, doesn't seem save in show.html.erb nor in database. this "_form.html.erb" <%= form_for(@account) |f| %> <% if @account.errors.any? %> <div id="error_explanation"> <h2><%= pluralize(@account.errors.count, "error") %> prohibited account being saved:</h2> <ul> <% @account.errors.full_messages.each |message| %> <li><%= message %></li> <% end %> </ul> </div> <% end %> <div class="form-group"> <%= f.label :first_name %><br> <%= f.text_field :first_name, class: "form-control" %> </div> <div class="form-group"> <%= f.label :last_name %><br> ...

matlab - selecting specific cells in a structure array based on the values of the field -

data looks more this: data = struct('direction',{[1,1,1,1],[1,1,2,1],[2,2,2,2,2],[2,2,2,2,1,2],[2,2,2,2]},'tr‌ial'{'correct','incorrect','incorrect','correct','correct'}); this example , have other fields well so example, want work cells in struct have trial correct , want select cells , store cells in separate struct . not sure if i'm clear or not apologize that. same if want select cells direction field vector have here different sizes want select vectors elements "2" only. thank you you can filter elements trial = 'correct' this: data = data(arrayfun(@(x) strcmp(x.trial, 'correct'), data)) if want filter elements direction = 2 (all values), this: data = data(arrayfun(@(x) all(x.direction == 2), data)) or can above in 1 line this: data = data(arrayfun(@(x) strcmp(x.trial, 'correct') & all(x.direction == 2), data))

python - ValueError: No backend available -

i try use acr122u , nfcpy library/module python 2.7 on mac os x 10.9.5. i followed instruction on site: http://nfcpy.readthedocs.org/en/latest/topics/get-started.html still error when typing: clf = nfc.contactlessfrontend('usb') traceback (most recent call last): file "<pyshell#1>", line 1, in <module> clf = nfc.contactlessfrontend('usb') file "nfc/clf.py", line 105, in __init__ if path , not self.open(path): file "nfc/clf.py", line 156, in open self.dev = nfc.dev.connect(path) file "nfc/dev/__init__.py", line 55, in connect found = transport.usb.find(path) file "nfc/dev/transport.py", line 169, in find d in cls.usb_core.find(find_all=true, **match)] file "/library/frameworks/python.framework/versions/2.7/lib/python2.7/site-packages/usb/core.py", line 1199, in find raise valueerror('no backend available') valueerror: no backend available any id...

javascript - Two ajax post calls with one submit button -

is possible do? 1 post call. want post call username/password , 1 email/password 1 submit button. if both succeeds, redirecting page best. ajax call jquery: $('form').submit(function() { $.ajax({ type: "post", url: $('form').attr('action'), data: $(this).serialize(), success: function(data, status, xhr) { alert("login successful. redirecting"); window.settimeout(function() { window.location.href = "3.3.3.3/login" }, 5000); }, error: function(data, status, xhr) { $('form').trigger("reset"); alert("failed login. please try again."); } }); return false; alert("ajax request completed"); }); <html> <head> <title>log in</title> <link rel="stylesheet" href="static"> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.8....

sql - mysql execution plan explanation -

there following query select count(*) my_table my_t my_t.c1 = '3' , my_t.c2 = '123' this table has index on (c1, c2) , both these columns have not null constraint. its execution plan: # id, select_type, table, type, possible_keys, key, key_len, ref, rows, 1, simple, my_t, ref, my_idx, my_idx, 157, const,const, 1, using where; using index it uses where, purpose? both columns not null index contain records , necessary count them. am missing something? the documentation says: using index the column information retrieved table using information in index tree without having additional seek read actual row. strategy can used when query uses columns part of single index. if extra column says using where , means index being used perform lookups of key values. without using where , optimizer may reading index avoid reading data rows not using lookups. example, if index covering index query, optimizer...

I deleted the VisualSVN server folder -

can ask deleted visualsvn server folder. how create 1 ? don't worry deleted folder because generated during installation process. thank in advance it's unclear mean "server folder". if mean %visualsvn_server% (e.g. "c:\program files\visualsvn server") can repair via control panel | programs , features.

branch - git checkout '...' always results in error: pathspec '...' did not match any file(s) known to git -

we ran problem our development branch. long story short, i've deleted branch , recreated master. however, every time create new clone of repository , checkout development following: $ git checkout development error: pathspec 'development' did not match file(s) known git. i'm able around problem using gregory mcintyre's answer from: git: cannot checkout branch - error: pathspec '...' did not match file(s) known git git checkout -t -b development origin/development i can use branch normal. however, next time clone repository we'll have same problem , have use same fix. it's development branch that's having problem, other branches work expected after fresh clone: $ git checkout staging branch staging set track remote branch staging origin. switched new branch 'staging' is possible fix development branch workaround isn't required?

datetime - remove the local timezone from a date in javascript? -

i wondering if can remove timezone date using javascript? datetime on json format want set returns more info of want/need. what have is: var d = new date(); d.settime(1432851021000); document.write(d); and output this: thu may 28 2015 16:10:21 gmt-0600 (cst) id show until hour, , moreve gmt-0600 (cst). i know javascript takes depending on current user's timezone, problem, because information saved on different countries. i trying avoid create format using like: d.date() + "/" + d.month()...etc is there better solution this? i believe d.todatestring() output format you're looking for. var d = new date(); d.settime(1432851021000); d.todatestring(); // outputs "thu may 28 2015" d.togmtstring(); //outputs "thu, 28 may 2015 22:10:21 gmt" or d.tolocalestring() "5/28/2015, 6:10:21 pm" there lots of methods available date()

javascript - Drop down menu on click on variable id -

i have page grid of images. want drop down appear on whatever image clicked. code have allows specific id, rather id. code have works fine, it's id specific. css: .wide { width:50px; } .high { height:50px; } table { border-collapse:collapse; margin:0px; padding:0px; } td { margin:0px; padding:0px; } td img { display:block; } .messagepop { background-color:#ffffff; border:1px solid #999999; cursor: pointer; display:none; margin-top: 5px; padding-left:2px; position:absolute; text-align:left; width:50px; z-index:50; font-family:tahoma; } .messagepop p, .messagepop.div{ border-bottom: 1px solid #efefef; line-height:1.3em; display:inline; } .close { color:blue; } html: <td class="wide high"> <div class="messagepop pop" id="x1y1pop"> <p>dfkj</p> <p>alksdjh</p> <p class="close">cancel...

php - Cleaner way to write this check? -

i have following 2 arrays ( var_dumped ): array (size=3) 'param' => array (size=1) 0 => string 'example' (length=7) 'page-template' => string 'general' (length=7) 'action' => object(closure)[2125] array (size=3) 'param' => array (size=1) 0 => string 'example' (length=7) 'page-template' => string 'general' (length=7) 'action' => object(closure)[2126] now same, call same function (in 'action' ) cannot === on them because of closure, wrote check: foreach(self::$registeredroutes[$routename] $routeactions) { if (!is_callable($action) && !is_callable($routeactions)) { if (isset($routeactions['param']) && isset($action['param']) && $routeactions['param'] === $action['param'] && isset($routeactions['page-template']) &...

java - What is the difference between Tomcat and TomEE, TomEE and TomEE Plus -

Image
i want deploy ejb ear in server confused choosing server among tomcat , tomee , tomee plus . what differences between tomcat , tomee ? what new features in tomee , tomee plus ? in case(s) make sense go tomee , tomee plus ? so need suggestions in order able make informed decision. this functions comparison matrix between tomcat , tomee , tomee+ : (source: http://tomee.apache.org/comparison.html ) 1. tomcat vs tomee tomcat servlet container, support servlet, jsp technology. tomee more extensive tomcat , support many java ee technologies (specificed jsr-xxx). 2. compare tomee vs tomee+ tomee contains: cdi - apache openwebbeans ejb - apache openejb jpa - apache openjpa jsf - apache myfaces jsp - apache tomcat jstl - apache tomcat jta - apache geronimo transaction servlet - apache tomcat javamail - apache geronimo javamail bean validation - apache bval tomee+ tomee plus distribution adds following: jax-rs - apache cx...

android - OpenFileInput does NOT throw FileNotFoundException -

i'm participating in online android course , have (so far) gotten no response on forum issue. i'm using android studio on windows 8.1. i have following function read file , load adapter: private void loaditems() { bufferedreader reader = null; try { fileinputstream fis = openfileinput(file_name); reader = new bufferedreader(new inputstreamreader(fis)); string title = null; string priority = null; string status = null; date date = null; while (null != (title = reader.readline())) { priority = reader.readline(); status = reader.readline(); date = todoitem.format.parse(reader.readline()); madapter.add(new todoitem(title, priority.valueof(priority), status.valueof(status), date)); } } catch (filenotfoundexception e) { e.printstacktrace(); } catch (ioexception e) { e.printstacktrace(); } catch (parseexcepti...

package - nuget pack content files only -

i'd create nuget package (from c# project), don't want embed generated dll, static files instead. i added tag @ end of nuspec file, nuget pack command continues embed project.dll in package. thing don't want dll published. is there way that? thanks, régis yes. can create .nuspec file references content files. you must use nuget pack mypackage.nuspec don't pack .csproj file causes nuget include built assembly. see http://docs.nuget.org/create/nuspec reference more info.

ruby on rails - What is the purpose of the 'metal' folder in a programming language? -

i'm looking @ rails actioncontroller , curious meaning behind 'metal' folder is? why name 'metal'? i know ember has ember-metal module , i'm sure there other programming use cases it. is there convention naming 'metal'? actionpack/lib/action_controller/metal/conditional_get.rb from this article written david heinemeier hansson think of rails metal subset of middleware intended application-specific end points need speed (“write metal”, hence name).

c - Should I fclose(file) if an error occured? -

code: file *fp = fopen(filename, "r"); if (!fp) { fprintf(stderr, "failed open file\n"); // fclose(fp) <-- should close file here? exit(1); } // operations on file. fclose(fp); question: if fopen() fails open file, should still call fclose() ? no, don't need call fclose() inside if block. once fopen() fails, retruns null need not closed . to elaborate, if fopen() success, return file * . needs closed. fwiw, returned pointer in case, of whatever value , gurantees compare unequal null. in other words, if fopen() success, returned pointer fail if(!fp) check. in error scenario (when file cannot opned some reason), null retrurned. null return value means, file not opened. don't close not opened. simple.

c++ - Compiler calculating mistake -

i have big homework assignment , got unexpected results, traced down following code for (int = 0; < 4; i++) cout << (int)((7163 / (int) pow (10, 4 - - 1))) % 10; to 7263 appears on screen, instead of 7163! not happen every 4 digit number , leaves me confused, there wrong logic or compiler's gone nuts. ideas how fix it? the problem here not compiler, rather standard library implementation of pow function. but not advisable use (int)(pow(n, k)) compute n k 2 integers. pow not guaranteed produce exact answer; may out small amount. (actually, accuracy not guaranteed @ all, implementations try not wrong more value of low order bit of result.) since casting (int) truncates rather rounds, tiny error can result in result being off 1. , in case, if result of pow(10,2) ends being 99.999999999999, converting int make 99, , 7163/99 72. so if insist on using pow , need ensure result rounded rather truncated (see round standard library function). bett...

synchronization - named reentrant/recursive lock (RLock) in Python -

the python multiprocessing module has class reentrant/recursive locks: from multiprocessing import rlock l = rlock() l.acquire() l.acquire() l.release() l.release() this works great processes forked common parent process and, hence, can share same rlock object. however, situations independent processes (example: web server + cron job), 1 need named lock. unfortunately, rlock() not accept name argument lock. there solution allows this? l = rlock('mylock') l.acquire() l.release() check out oslo_concurrency.lockutils . has lock context manager , synchronized decorator, both of take name , other handy interprocess-friendly parameters.

scala - Spark: Counting co-occurrence - Algorithm for efficient multi-pass filtering of huge collections -

there table 2 columns books , readers of these books, books , readers book , reader ids, respectively : books readers 1: 1 30 2: 2 10 3: 3 20 4: 1 20 5: 1 10 6: 2 30 record book = 1, reader = 30 means book id = 1 read user id = 30 . each book pair need count number of readers read both of these books, algorithm: for each book each reader of book each other_book in books of reader increment common_reader_count ((book, other_book), cnt) the advantage of using algorithm requires small number of operations compared counting book combinations two. to implement above algorithm organize data in 2 groups : 1) keyed book, rdd containing readers of each book , 2) keyed reader, rdd containing books read each reader, such in following program: import org.apache.spark.sparkconf import org.apache.spark.sparkcontext import org.apache.spark.sparkcontext._ import org.apache.log4j.logger import org.apache.log...

Does SonarQube count comment blocks in duplicated code? -

simple question. sonarqube has duplicate code scanner. examine comment blocks in algorithm? if have 1000 source files same copyright header, detect these duplicated code? from sonarqube documentation on duplications : sonarqube allows detect "type 2" duplications means : structurally/syntactically identical fragments except variations in literals , comments. so copyright header not counted duplication.

cordova plugin.xml framework replaces my build.gradle -

i write below <framework src="platforms/android/imkit" custom="true" /> but build.gradle file under platforms/android/imkit replaced cordova own one. how avoid cordova replacing build.gradle file. i renamed build.gradle build-extras.gradle, ok.

python - Django: Limiting foreign key choices based on related object -

i'm not sure of correct terminology explain need, think easiest way example. i have following models - company , software asset. class company(models.model): name = models.charfield(max_length=200) class softwareasset(models.model): name = models.charfield(max_length=200) i map various companies software assets own. example, companies may own 'microsoft office' asset, few may own 'adobe photoshop'. use join table (again, i'm not sure if correct term, or more importantly, correct way of going this). class companyassets(models.model): company = models.foreignkey(company) asset = models.foreignkey(softwareasset) i need define employees along company employed by: class employee(models.model): name = models.charfield(max_length=200) company = models.foreignkey(company) and finally, need define applications each employee has access to: class employeesoftware(models.model): employee = models.foreignkey(employee) asse...

javascript - How to modify JSON Stringified form information on jQuery -

hi guys taking form values on submit. firstly use var data = json.stringify(frm.serializearray()); and result gives me [{"name":"devicename","value":"ball"},{"name":"devicetype","value":"4949"}] but json should {"devicename":"ball","devicetype":4949} and should determine whether value string or int, while modifying json this how can do var x = [{"name":"devicename","value":"ball"},{"name":"devicetype","value":"4949"}]; var y = {}; $.each(x,function(key,value){ y[value['name']]= value['value']; }); console.log(json.stringify(y)); note: have taken variable names x , y , can choose have meaningful variable names. if want know datatype of value can use typeof inside each loop. look @ fiddle link jsfiddle

c++ function ptr in unorderer_map, compile time error -

i trying implements unorderer_map implements mapped_type, watching examples implements these cannot make work. here code: #include<string> #include <unordered_map> namespace test { class example { public: example() { auto apair=std::make_pair("one",&example::processtring); map.insert(apair); } void processtring(std::string & astring) { } void processstringtwo(std::string & astring) { } typedef void(*fnptr)(std::string &); std::unordered_map<std::string,fnptr> map; }; } int main() { return 0; } i compile time error: error: no matching function call 'std::unordered_map, void (*)(std::basic_string&)>::insert(std::pair, void (test::example::*)(std::basic_string&)>&)' thx! a function pointer , member function pointer 2 different things. either need add free function map or need change map take member function pointer instead. i...

wcf - Odata Parsing $metadata -

i'm hosting odata service exposes tables , properties db. i can request metadata db using [hosturl]?$metadata property. return table names , columns in xml format. i wondering if there built in odata class parse this, can grab out tables, , columns or have manually? you can use odatalib parse metadata model described here: http://odata.jenspinney.com/2013/02/creating-an-iedmmodel-from-a-metadata-document/

swift - How do I add a timer to an iOS app that ends the game when the timer reaches 0? -

i making quiz app using swift. want add timer countsdown 60 seconds (1 minute) when reaches 0, game over. how add timer? this you, put appropriate game logic on updatetimer function , stopcountdowntimer function. class timertestviewcontroller: uiviewcontroller { var totalsecondscountdown = 60 // 60 seconds // timer var timer : nstimer! override func viewdidload() { super.viewdidload() self.startcountdowntimer() } func updatetimer() { if self.totalsecondscountdown > 0 { self.totalsecondscountdown = self.totalsecondscountdown - 1 println("timer countdown : \(self.totalsecondscountdown)") } else { self.stopcountdowntimer(); println("timer stops ...") } } func startcountdowntimer() { if self.timer != nil { self.timer.invalidate() self.timer = nil } if self.totalsecondscountdown > 0 { self.timer = nstimer.scheduledtimerwithtimeinterval(1.0, target: s...

c - String literals vs array of char when initializing a pointer -

inspired this question . we can initialize char pointer string literal: char *p = "ab"; and fine. 1 think equivalent following: char *p = {'a', 'b', '\0'}; but apparently not case. , not because string literals stored in read-only memory, appears through string literal has type of char array, , initializer {...} has type of char array, 2 declarations handled differently, compiler giving warning: warning: excess elements in scalar initializer in second case. explanation of such behavior? update: moreover, in latter case pointer p have value of 0x61 (the value of first array element 'a' ) instead of memory location, such compiler, warned, taking first element of initializer , assigning p . i think you're confused because char *p = "ab"; , char p[] = "ab"; have similar semantics, different meanings. i believe latter case ( char p[] = "ab"; ) best regarded short-hand not...

javascript - Custom markers for google places -

i using code below display custom markers on page using google places. var iconurl; if(place.types[0] == 'lodging'){ iconurl = 'custom-markers/hotel_marker.png'; } else { iconurl = place.icon; } how can change code above can display custom markers more 1 category? for example: if(place.types[0] == 'bars'){ iconurl = 'custom-markers/bar_marker.png'; } how about: var iconurl; if(place.types[0] == 'lodging'){ iconurl = 'custom-markers/hotel_marker.png'; } else if(place.types[0] == 'bars'){ iconurl = 'custom-markers/bar_marker.png'; } else { iconurl = place.icon; } the associative array approach like: var placeurllookup = { lodging: 'custom-markers/hotel_marker.png', bars: 'custom-markers/bar_marker.png' }; var iconurl = place.icon; //set default here if (place.types[0] in placeurllookup) { iconurl = placeurllookup[place.types[0]]; }

php - File submission worked until I added jQuery, whats the issue? -

i having strange issue able submit files , upload them, have added bit of jquery within head of webpage, doesn't seem work anymore: i tested once again without jquery , works fine , jquery messing somewhere. anyway can accomplish same objective, differently? jquery: $(document).ready(function() { var options = $('select[name=itemtype]'); var optionval = options.val(); var filer = $('input[name=itemfile'); var filerval = $('input[name=itemfile]').val(); options.change(function() { optionval = $(this).val(); if(optionval == 1 || optionval == 3) { $('input[name=itemcontact]').removeattr('disabled'); $('input[name=itemcontact]').attr('required','true'); } else { $('input[name=itemcontact]').attr('disabled','true'); $('input[name=itemcontact]').removeattr('required'); }; ...

javascript - How to sort out the data in the table after the data was loaded from the data base? -

i have data in database , displayed on page. necessary sort data out pressing column title. after opening page see empty table filled data database within 5~10 seconds. if use plugin angularjs datatables , insert tag datatable="ng" , 1 can see icons sorting after pressing of icons make table invisible. here's code. <div class="table-responsive"> <table class="table table-striped" ng-controller="mostpopularstablecontroller"> <thead ibox-tool> <tr ts-repeat> <th>title</th> <th></th> <th>link</th> <th>network</th> <th>count</th> <th>clicks</th> <th>ctr</th> </tr> </thead> <tbody> <tr ng-repeat="data in mostpopulars"> ...

mysql - How to efficiently invalidate cache? -

i’ve been trying optimize performance 1 behemoth software based on php , mysql. have gone through caching in apache , indexes in mysql not enough. since forms within software built , printed dynamically configuration in database software sends huge number of sql’s , lot of joins slows whole thing when there many concurrent users connected (on average 200-300). since cannot touch code, have seen mysql-proxy can placed between application server , database server , on there query results can cached accessing redis o memchached via lua . idea cache everything. however, problems invalidating cache. once record updated how invalidate cached result sets? one of ideas convert sql query md5 , store result key of set. analysis of query , store same md5 key , references table. example: query: select * products left join users on products.user_id = user.id cache instance a 3b98ab273f45af78849db563df6598d1– {result set} cache instance b products - 3b98ab273f45af78849db563d...

excel vba - Acces VBA: Discard "can't append" message (Primary Key Violation) -

i'm trying create macro in access 2010 opens excel file, runs macro in excel , imports given results. have 2 problems process. application.displayalerts = false in excel nevertheless displayalerts keep popping up. need special in macro access? alert "can't append due primary key violations" keeps popping up. know problem is, want ignore it. can use on error resume ? want @ end messagebox the table hasn't append to. possible , can point me in right direction. tried errorhandeling don't know how make message popup @ end without interrupting process. code: private sub main_btn_click() dim fileimport(0 3, 0 2) string fileimport(0, 0) = "stock_cc" fileimport(0, 1) = "f:\370\hyperviseur\situatie\macro\stock_getdata.xlsm" fileimport(0, 2) = "getstock" fileimport(1, 0) = "wips_cc" fileimport(1, 1) = "f:\370\hyperviseur\situatie\macro\wips_getdata.x...

Oracle date coding returning min date value -

i have table returning 2 rows same data on including start date same both rows in question, there update date column different per row. how find 1 closest start date. e.g. date 1 27/01/2014 date 2 27/01/2015 07:39:30 date 2 row 2 27/01/2015 11:30:51 there plenty of other columns involved these relevant ones, how return row earliest date? row containing 07:39:30 have tried using min function returning both rows. how return row earliest date? row containing 07:39:30 have tried using min function returning both rows. in oracle , date data type has both date , time portions. date function applied on date column give perfect result, unless have design issue . frequent design problems related storing date values string . for example, among below mentioned date values, 27/01/2015 07:39:30 27/01/2015 11:30:51 the min function on above mentioned date values return 27/01/2015 07:39:30 .

date - How to match dateuilts.rrule and python icalendar daylightsavingtime aware -

i'm dealing ical problems. i have ical event. begin:vevent uid:event/termine/gps/akt@portal.augusta.de dtstart;tzid=cet:20150529t190000 dtend;tzid=cet:20150529t220000 categories:arbeitsgruppe dtstamp:20110620t075538z exdate;tzid=cet:20151225t190000 last-modified:20150424t201707z location:vereinsräume des augsburger computer forum e.v. priority:5 rrule:freq=monthly;byday=-1fr summary:gps-arbeitsgruppe url:https://www.augusta.de/termine/gps end:vevent as can see there rrule repeating event every last friday of month. i parsed ical icalendar. i'm using: start = iobj.get( 'dtstart' ).dt rrset = rruleset() rrule = iobj.get( 'rrule' ) exdate = iobj.get( 'exdate' ) rrset.rrule( rrule.rrulestr( rule.to_ical(), dtstart = start ) ) edate in exdate.dts : rrset.exdate( edate.dt ) everything far works fine. when try next 10 dates with: list(rrset)[:10] i get: [datetime.datetime(2015, 5, 29, 19, 0, tzinfo=<dsttzinfo 'cet' ce...

c# - How can I convert my comments to Log.Information call on compile time? -

i want log comments on source file in final assembly. building file system based on comments can't convert log.information calls. i want final executable has log.information("//comment on source") calls , source still has //comment on source . how can that?

Matlab. How to draw image -

i have 1 function, returns vector data. should draw image depending on data. for simplify let's consider example: function returns [4, 10, 3], should draw 10 x 3 rectangle , 4 circles around rectangle. need save image file, isn't necessarily. there's different functions drawing/plotting, can't understand should use. i'm using matlab 2013a, if matter. would grateful articles/code snippets task. look @ rectangle in help. drawing circles. i'm not joking. this looked for.

openshift - ERROR: Could not find a valid gem 'rhc' (>= 0) in any repository -

i trying install openshift client tools c:\> gem install rhc but giving error error: not find valid gem 'rhc' (>= 0) in repository how avoid , install rhc. gem sources --remove https://rubygems.org/ gem sources --add http://rubygems.org/

ios - How do I customize a UITableview right, top and bottom border? -

how can set right, left, top , bottom border color on uitableview in swift? thanks, try full border: yourtable.layer.maskstobounds = true yourtable.layer.bordercolor = uicolor( red: 153/255, green: 153/255, blue:0/255, alpha: 1.0 ).cgcolor yourtable.layer.borderwidth = 2.0 this bottom border: let border = calayer() let width = cgfloat(2.0) border.bordercolor = uicolor.darkgraycolor().cgcolor border.frame = cgrect(x: 0, y: yourtable.frame.size.height - width, width: yourtable.frame.size.width, height: yourtable.frame.size.height) border.borderwidth = width yourtable.layer.addsublayer(border) yourtable.layer.maskstobounds = true

phpstorm - Firefox addon development using JetBrains WebStorm. What to do with numerous warnings? -

Image
i developing firefox addon now. have tried lot of ides javascript , ended jetbrains webstorm. when opened project(about 1000 lines) in webstorm first time showed me 500 warnings. of warnings "unresolved function or method" , "unresolved variable or type". for example 2 lines contain 4 warnings: let sss = cc["@mozilla.org/content/style-sheet-service;1"].getservice(ci.nsistylesheetservice); sss.loadandregistersheet(uri, sss.author_sheet); getservice (unresolved function or method) nsistylesheetservice (unresolved variable) loadandregistersheet (unresolved function or method) author_sheet (unresolved variable) for disabled warnings. maybe it's not best way handle problem? there "libraries" in webstorm jquery, ext js, prototype, dojo , other. , custom javascript library can added. there way add/create such custom library? or there way handle warning not disabling them @ all? p.s. there's komodo ide provides such autocomplet...

Accessing a logger across multiple modules in Python logging -

i have little question regarding python logging module. i have simple logger logger=basicconfig() how access same logger using getlogger()? or getlogger() give me logging object can access? if how access same logger in program? apologies if wrong place ask this. the python logging.getlogger(name) returns same logger object name within process. the python best practice of using of loggers each python module defines own logger @ beginning of .py file.: import logging logger = logging.getlogger(__name__) # logger def foobar(): logger.debug("in foobar") this allows later turn on , off , adjust levels of individual loggers using python's logging configuration. generally, not want share logger across modules unless have specific use case.

c# - Code Contracts - ForAll - What is supported by static verification -

there numerous information static checking of contract.forall has limited or no support. i did lot of experimenting , found it can work with : contract.forall(items, => != null) contract.forall(items, p) p of type predicate<t> it cannot work with: field access property access method group (i think delegate allocated here anyway) instance method call my questions are: what other types of code forall can work with? does code contracts undertand after contract.forall(items, => != null) proven, when taking 1 item list later in code (i.e. indexing), item not null? here full test code: public sealed class test { public bool field; public static predicate<test> predicate; [pure] public bool property { { return field; } } [pure] public static bool method(test t) { return t.field; } [pure] public bool instancemethod() { return field; } public static...

javascript - Import Data From Website Database -

what trying import data excel web query. problem face ip address (ex. 10.10.111.20) shows page 1 20 rows of entry data. can click page2 , show page2 , on. trying either select pages , export data excel or create unique url http://10.10.111.20/?javascript:_dopostback ('gridview1','page$2')< i having no luck show still 1st page inspect link "next page" or "page 2", behind it, link to? luck uses get, , have url need use each page.

authentication - How to fix login for google-sites-liberation to backup google apps for domain sites again? -

for few days backup of google sites using google-sites-liberation stopped working. the call java -cp google-sites-liberation.jar com.google.sites.liberation.export.main -d "$domain" -w wiki -u "$user" -p "$password" -f "$dir/" 2>&1 which worked before fails with: may 29, 2015 1:48:23 pm com.google.sites.liberation.export.main domain severe: invalid user credentials! exception in thread "main" java.lang.runtimeexception: com.google.gdata.util.authenticationexception: error authenticating (check service name) @ com.google.sites.liberation.export.main.domain(main.java:89) @ com.google.sites.liberation.export.main.main(main.java:97) caused by: com.google.gdata.util.authenticationexception: error authenticating (check service name) @ com.google.gdata.client.googleauthtokenfactory.getauthexception(googleauthtokenfactory.java:614) @ com.google.gdata.client.googleauthtokenfactory.getauthtoken(googleauthtokenfa...

Runtime of an easy while loop -

i have short question runtime of while loop. have given code: calculate(int n) = n while(i > 0) = i/2 if n power of two, how while loop executed. doing revision on did @ beginning of semester , know it's not hard don't know how answer. example if n = 1, loop executed 1 time, if n = 2, loop executed 2 times, if n = 4, loop executed 3 times , on not sure how formulate mathematically. a mathematical formula use binary logarithm : log2(n) + 1

postgresql - What is the use for Auto FK index in pgAdmin? -

when creating foreign key constraint in postgresql from pgadmin (1.12.2 in case), following option checked: auto fk index i know if it's right leave checked time, , understand how overhead works. for instance, following constraint: alter table "user" add constraint fk_user_region foreign key (intregionid) references region (intid) match simple on update no action on delete no action; creates following index: create index fki_user_region on "user" using btree (intregionid); note creates index only when creating constraint from pgadmin . there not documentation pgadmin, , nothing option. thank you.

list - Simultaneously Iterate over multiple arrayLists in Java..Most efficiently -

i writing api, creates list of user objects , makes call 3rd party webservice list. 3rd party webservice responds list of userdetails objects containing details of users. ex: class user{ string id; string name; } a list constructed above user objects , passed on 3rd party webservice. list<user> users = new arraylist <user>(); the 3rd party webservice responds list of userdetails objects. class userdetails { string id; string email; string accountnumber; ... ... } list<userdetails> userdetails = new arraylist <userdetails>(); now, construct response of api, construct list of userresponse objects contains mix of fields in user , userdetails objects. class userresponse{ string id; string name; string email; string accountnumber; .... ... } to construct list of userresponse objects, have iterate on user list , userdetails list , check if id's match , construct userrepsonse object , add them list. code below. list ...

mercurial - producing a installable python module using hg archive vs wheel -

i wonder if release python modules using: hg archive , sourceforge download wheel , pypy hosting i using 1 years now, think right pythonic way 2 any piece of advice ? wheel requires pip, wheel, setuptools... looks quite complicated simple module compared simple tar extract , setup.py install. on other hand, seems pip/wheel being required? it's quite simple . and yes python wheels recommended approach going forward use of pip install , maintain installations of packages. example: ( packaging module ) create setup.py : install wheel register , upload pypi example: setup.py : from setuptools import setup, find_packages setup( name="mypackage", version="0.0.1", description="my description", long_description=open("readme.rst", "r").read(), author="you", author_email="your email address", packages=find_packages("."), ) note: bare...

angularjs - Angular [$injector:unpr] Unknown provider with customize directive -

i have little issue using customize directive within template field of ui-bootstrap modal directive. my aim send data modal via resolve attribute , re-use these resolved parameters inside controller of own directive. var app = angular.module('app', ['ui.bootstrap']); app.controller('myctrl', ['$scope', '$modal', function($scope, $modal) { $scope.openmodal = function () { var popup = $modal.open({ template: '<my-modal></my-modal>', resolve : { mydata : function() { return 42; } } }); }; }]); app.controller('modalcontroller', ['$scope', 'mydata', function($scope, mydata) { //the error in directive controller $scope.mydata = mydata; }]); app.directive('mymodal', function() { return { restrict: 'e', templateurl : 'mymodal.html', controller : 'modalc...

Hidden Password ACM 2003 my O(n) solution -

i have seen question being asked in stackoverflow. implemented o(n) solution problem, got accepted on spoj ( http://www.spoj.com/problems/minmove ) giving wrong answer on ( https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&itemid=8&page=show_problem&problem=756 ) . please have @ code. #include<stdio.h> #include<string.h> #include<malloc.h> int main() { char *s=(char *)malloc(sizeof(char)*100011); int test; scanf("%d",&test); while (test--){ int i=0,j=1,k=0,n; scanf("%d",&n); scanf("%s",s); long long let=(n<<1); while (i+k<let&&j+k<let) { if (s[(i+k)%n]==s[(j+k)%n]) k++; else if (s[(i+k)%n]>s[(j+k)%n]) { i=i+k+1; if (i<=j) i=j+1; k=0; } else { j=j+k+1; if (j<=i) j=i+1; k=0; } } i=i<j?i:j; printf("%d\n",i); } return 0; }

java httpclient 4.x performance guide to resolve issue -

there nice article http://hc.apache.org/httpclient-3.x/performance.html related http performance, pooling, e.t.c. can't find same latest 4.x version. did see it? met perf issues under heavy load , resolve them. i'm using 4.1 version. here profiler output: 26% org.apache.http.impl.client.closeablehttpclient.execute(multiple parameter matches) :26,107,40 26% org.apache.http.impl.client.closeablehttpclient.execute(org.apache.http.client.methods.httpurirequest, org.apache.http.protocol.httpcontext) :82,46 26% org.apache.http.impl.client.abstracthttpclient.doexecute(org.apache.http.httphost, org.apache.http.httprequest, org.apache.http.protocol.httpcontext) :882,818 26% org.apache.http.impl.client.abstracthttpclient.createhttpcontext() :301 26% org.apache.http.impl.client.abstracthttpclient.getconnectionmanager() :484 26% org.apache.http.impl.client.abstracthttpclient.createclientconnectionmanager() :321 26% org.apache.http.impl.conn.schemeregistryfactory.createdefault() :52 ...