Posts

Showing posts from January, 2015

c# - no combination of intermediate filters could be found -

i'm making windows form application using visual studio. application allows enter want photo named, , saves image specific location on network. works great when use on laptop. however, when try run on desktop, not work. instead message: system.runtime.interopservices.comexception (0x80040217): no combination of intermediate filters found make connection. at directshowlib.dserror.throwexceptionforhr(int32 hr) at orderproductcapture.capture.setupgraph(dsdevice dev, int32 iwidth, int32 iheight, int16 ibpp, control hcontrol) at orderproductcapture.capture.ctor(int32 idevicenum, int32 iwidth, int32 iheight, int16 ibpp, control hcontrol) at orderproductcapture.frmmain.ctor() the call stack says: orderproductcapture.exe!orderproductcapture.capture(int idevicenum, int iwidth, int iheight, short ibpp, system.windows.forms.control hcontrol) line 82 orderproductcapture.exe!orderproductcapture.frmmain.frmmain() line 50 orderproductcapture.exe!order

Fetching all rows as Object with pdo php -

i know function fetchobject ( http://www.php.net/manual/en/pdostatement.fetchobject.php ) gives me next row object of specified class, want rows object of specified class, pdo has function or have manually??? thanks!! you looking pdostatement::fetchall : pdostatement::fetchall — returns array containing of result set rows example usage: $arr = $stmt->fetchall(pdo::fetch_class, $class_name, $constructor_args); if not need of objects in single array, find iterating through rows work well: while ($obj = $stmt->fetchobject($class_name, $constructor_args)) { // process $obj }

javascript - How can I speed up this sequence of promises? -

i have following http request handled in node server. have send list of disks response. the code is: diskpromise.getdiskcount(client).then(function (diskcount) { diskpromise.getdisks(client, diskcount).then(function (disks) { raidpromise.getraidcount(client).then(function (raidcount) { raidpromise.getraidarrays(client, raidcount).then(function (raidarrays) { (i in disks) { disks[i].setraidinfo(raidarrays); } raidpromise.getglobalsparelist(client).then (function(sparenames) { (i in disks) { disks[i].setspareness(sparenames); } res.json(disks); }, function (err) { console.log("something (either getdiskcount, or 1 of getdisk calls) blew up", err); res.send(403, { error: err.tostring() }); }); }); }); }

ios - NSPredicate for NSFetchedResultsController when searching a relationship -

i working nsfetchedresultscontroller. want display in table view lions in zoo, lions to-many relationship of zoo. there thousands of lions, need batch size of 20. nsfetchrequest* fetchrequest = [[nsfetchrequest alloc] init]; nspredicate* predicate = ??? nsentitydescription* entity = [nsentitydescription entityforname:@"lion" inmanagedobjectcontext:context]; [fetchrequest setentity:entity]; [fetchrequest setpredicate:predicate]; [fetchrequest setfetchbatchsize:20]; how set predicate? have zoo object. need lions. as know nspredicate class specifies how data should fetched or filtered. nsfetchrequest has predicate property, specifies logical conditions under managed objects should retrieved. here's great example on how can use core data - http://nshipster.com/nspredicate/

python - Return tuple of any two items in list, which if summed equal given int -

for example, assume given list of ints: int_list = list(range(-10,10)) [-10, -9, -8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9] what efficient way find if given 2 values in int_list sum equal given int, 2 ? i asked in technical phone interview morning on how efficiently handle scenario int_list of say, 100 million items (i rambled , had no answer :/). my first idea was: from itertools import combinations int_list = list(range(-10,10)) combo_list = list(combinations(int_list, 2)) desired_int = 4 filtered_tuples = list(filter(lambda x: sum(x) == desired_int, combo_list)) filtered_tuples [(-5, 9), (-4, 8), (-3, 7), (-2, 6), (-1, 5), (0, 4), (1, 3)] which doesn't work range of range(-10000, 10000) also, know of online python performance testing tool? for integer a there @ 1 integer b sum equal integer n . seems easier go through list, arithmetic, , membership test see if b in set. int_list = set(range(-500000, 500000)) target_num = 2 de

Login to the MVC 5 ASP.NET template Web Application fails when moved from the root folder -

i used asp.net web application template create new "single page application" "authentication: individual user accounts". run default settings without problem. if don't deploy application root folder of web server authentication fails. culprit in app.viewmodel.js file following code can found: self.addviewmodel = function (options) { var viewitem = new options.factory(self, datamodel), navigator; // add view appviewmodel.views enum (for example, app.views.home). self.views[options.name] = viewitem; // add binding member appviewmodel (for example, app.home); self[options.bindingmembername] = ko.computed(function () { if (!datamodel.getaccesstoken()) { // following code looks fragment in url access token // used call protected web api resource var fragment = common.getfragment(); if (fragment.access_token) { // returning access token, restore old hash, or

ios - UIWebView apparently scrolled after loading content from URL -

Image
i loading html document uiwebview loadrequest:requesturl . html content not fit entirely view's frame. surprises me @ time page has been loaded (when webviewdidfinishload: is called) view's scrollview.contentoffset different (0,0) . looks if content may have been scrolled down approximately vertical center aligned view's vertical center (see screenshot below). how can happen , how can achieve desired behavior of having content's top left corner aligned view's top left corner initially? setting scrollview.contentoffset (0,0) in webviewdidfinishload:` option apparently leads flickering. this occurring in context of uiviewcontroller contains 2 sibling uiwebview s below root view. 2 uiwebview s vertically stacked uilabel (appears in screenshot gray background) in between. (the lower uiwebview not visible in screenshot, because it's white.) view uses constraint-based layout , current problem concerns upper uiwebview . update further study has reveal

spring mvc - Strings with double quotes in messages.properties are not displayed correctly -

i doing spring web application. in messages.properties file, there one-line string follows: label.name.tooltip=the "name" field ... my jsp file displays string follows: <spring:message code="label.name.tooltip" /> however, displayed text "the", means part "name" cut. i dont know why happens. googled , ways such adding backslash before double quotes not working. regards , thanks! update the whole problem caused me using string in title attribute of tag follows: a href="#" data-toggle="tooltip" title="<spring:message code="label.name.tooltip" /> as bossie hinted, browser removes string content starting double quote. misha did quite explanation, helped me understand more how message works. thanks, misha!!! i found solution @ in case, use "name" instead of double quotes. hope helps else. spring resolves message codes using messagesource , in turn uses messag

ruby - Opening multiple html files & outputting to .txt with Nokogiri -

just wondering if these 2 functions done using nokogiri or via more basic ruby commands. require 'open-uri' require 'nokogiri' require "net/http" require "uri" doc = nokogiri.parse(open("example.html")) doc.xpath("//meta[@name='author' or @name='author']/@content").each |metaauth| puts "author: #{metaauth}" end doc.xpath("//meta[@name='keywords' or @name='keywords']/@content").each |metakey| puts "keywords: #{metakey}" end etc... question 1: i'm trying parse directory of .html documents, information meta html tags, , output results text file if possible. tried simple *.html wildcard replacement, didn't seem work (at least not nokogiri.parse(open()) maybe works ::html or ::xml) question 2: more important, possible output of meta content outputs text file replace puts command? also forgive me if code overly complicated simple task being performed,

php - How to Pass Smarty variable or array in Chart.js scripts -

i using chart.js creating line charts. using php , smarty. creating string , passing smarty . when pass smarty variable chart.js shows syntax error stops charts. so want know proper way use chart.js php , smarty. any appreciated. that's code use: var tp = { $tot_app }; var total_app = tp.split(','); //day applications var dayp = { $dtcnt }; var day_arr = dayp.split(','); //dates var dt_p = { $dates }; var arr_t = dt_p.split(','); var linechartdata = { labels: arr_t, datasets: [{ fillcolor: "rgba(220,220,220,0.5)", strokecolor: "rgba(220,220,220,1)", pointcolor: "rgba(220,220,220,1)", pointstrokecolor: "#fff", data: total_app }, { fillcolor: "rgba(151,187,205,0.5)", strokecolor: "rgba(151,187,205,1)", pointcolor: "rgba(151,187,205,1)", pointstrokecolor: "#fff", data:

ios - Saving and reading objects from plist cause huge memory of 2G -

i have system save lots of images plist , works good, except 2 main problems. first, when start process ,memory on xcode goes 2g ! (and down when done) second, takes long(10+ seconds 100 images)compared nsuserdefaults , told slower . i archiving data first. what doing wrong having memory , slow saving ? -(void)savetofilewithdata:(nsmutabledictionary*)dic { nserror *error; nsarray *paths = nssearchpathfordirectoriesindomains(nsdocumentdirectory, nsuserdomainmask, yes); nsstring *documentsdirectory = [paths objectatindex:0]; nsstring *path = [documentsdirectory stringbyappendingpathcomponent:@"data.plist"]; nsfilemanager *filemanager = [nsfilemanager defaultmanager]; if (![filemanager fileexistsatpath: path]) { nsstring *bundle = [[nsbundle mainbundle] pathforresource:@"data" oftype:@"plist"]; [filemanager copyitematpath:bundle topath: path error:&error]; } nsdata *mydata = [nskeyedarchiv

javascript - Get event after function complete -

i have form people can delete records; <a href="/delete/1" class="confirm-action">delete record 1</a> <a href="/delete/2" class="confirm-action">delete record 2</a> <a href="/delete/3" class="confirm-action">delete record 3</a> to ensure sure, using "are sure" confirmation script ( popconfirm ) gives nice little popup confirmation. $(".confirm-action").popconfirm(); if user clicks cancel, nothing happens. if click 'yes' - link processed , record deleted. working intended. now instead of following link (when user clicks 'yes'), want fire ajax request: $('.confirm-action').click(function(event) { event.preventdefault(); $.ajax({ // ajax stuff here }); }); $(".confirm-action").popconfirm(); the problem when try this, functions fired in correct order when expected, except event null , script fail

haskell - Printing definitions of functions/classes in ghci with lambdabot -

how can view source definitions in ghci (with lambdabot 2.5 ghci on acid ) of functions/classes etc defined in project or cabal dependencies? example suppose have : module main import system.random gen = (random (mkstdgen 0)) :: (bool,stdgen) myadd :: int -> int myadd x = 2 * x main = print "finished" then can information on myadd , random cannot print source. here can in ghci (with lambdabot) : *main goa> :src foldr foldr f z [] = z foldr f z (x:xs) = f x (foldr f z xs) *main goa> :i myadd myadd :: int -> int -- defined @ test.hs:7:1 *main goa> :src myadd source not found. don't think can friend on facebook anymore. *main goa> :i random class random ... random :: randomgen g => g -> (a, g) ... -- defined in ‘system.random’ *main goa> :src random source not found. listen, broccoli brains, don't have time listen trash. lambdabot seems able print definitions of foldr not functions defined in project (

JavaScript: change function(this) to function(this.id) -

i have javascript function open kcfinder file manager url textbox. js: <script type="text/javascript"> function openkcfinder(field) { window.kcfinder = { callback: function(url) { field.value = url; window.kcfinder = null; } }; window.open("http://localhost/cms/kc/browse.php?type=video&dir=files/public", "kcfinder_textbox", "status=0, toolbar=0, location=0, menubar=0, directories=0, " + "resizable=1, scrollbars=0, width=800, height=600" ); } </script> html: <input id="video" onclick="openkcfinder(this)" class="form-control" type="text" name="video" placeholder="add video"> // need change openkcfinder(this.id) <input id="audio" onclick="openkcfinder(this)" class="form-control" type="text" name="video" placeholder=&quo

c++ - How to pass ostream objects? -

i have struct this struct x{ ostream out; x() : out(cout) {} ... }; and noticed have define out & correctly pass cout default parameter: ostream &out; don't know why , don't know if there other possibilities keeping ostream without &. furthermore, when try set x x; ofstream out; x.out = out; the compiler found many errors... want able set x::out cout or ofstream. how it? ostreams cannot passed value. have pass reference or pointer. if want ability make x.out refer different streams during lifetime, make pointer. otherwise make reference.

javascript - Node.js Forver keeps stopping other services running on the same box -

i using node.js forever run web service , website on machine. these services in files called app.js , site.js respectively i run multiple environments on same box , have been having devil of time keeping production or development instances every time start both services 1 seems kill other. it appears node js uses name of script index rather full path. thus if following commands run user@somehost:somepath/dev/someservice/$ forever app.js start user@somehost:somepath/dev/someservice/$ cd ../../prod/someservice user@somehost:somepath/prod/someservice/$ forever app.js start with hindsight kind of obvious issue stopping of serivces. when running user@somehost:somepath/prod/someservice/$ forever app.js stop both services stop. problem addressed using qualified path javascript file.

How to compile and install a 32Bit library on a 64 Bit (Ubuntu 12.04LTS) Linux using autotools, make and gcc? -

i'm trying compile 32bit version of linux library on 64bit ubuntu 12.04lts running inside vm (virtualbox). so far i've downloaded source, unzipped , performed following steps build lib: libtoolize --force automake --add-missing ./configure --build=i686-pc-linux-gnu "cflags=-m32" "cxxflags=-m32" "ldflags=-m32" make sudo make install with i've been able build compile library but, once run "readelf -h" on compiled lib following output: elf header: magic: 7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00 class: elf64 data: 2's complement, little endian version: 1 (current) os/abi: unix - system v abi version: 0 type: dyn (shared object file) machine: advanced micro devices x86-64 version: 0x1

c - Process ID is always 0 in linux, Is it valid? -

my program finds pid in linux. it’s returning 0. supposed this? used gcc . valid? when process ids without 0? here code. #include <stdio.h> #include <unistd.h> #include <stdlib.h> #include <sys/types.h> int main() { pid_t pid; /* process id */ if ((pid = getpid()) < 0) perror(" unable pid"); else printf(" process id %d", pid); return (0); } so after compiling program prints in terminal “the process id is: 0”.

objective c - Cocoa - detect event when camera started recording -

in osx application i'm using code below show preview camera. [[self session] beginconfiguration]; nserror *error = nil; avcapturedeviceinput *newvideodeviceinput = [avcapturedeviceinput deviceinputwithdevice:capturedevice error:&error]; if (capturedevice != nil) { [[self session] removeinput: [self videodeviceinput]]; if([[self session] canaddinput: newvideodeviceinput]) { [[self session] addinput:newvideodeviceinput]; [self setvideodeviceinput:newvideodeviceinput]; } else { dlog(@"wtf?"); } } [[self session] commitconfiguration]; yet, need detect exact time when preview camera becomes available. in other words i'm trying detect same moment in facetime under osx, animation starts once camera provides preview. what best way achieve this? i know question old, stumbled upon when looking same question, , have found answers here goes. for starters, avfoundation high level, you'll need drop do

java - How to name JFrame in a constructor -

question may different expected, i'm creating utility function jframes make easier future me. public void setjframe(string title, int w,int h, jframe name, boolean maximize){ name.setsize(w, h); name.settitle(title); if (maximize == true) { name.setextendedstate(name.getextendedstate()|jframe.maximized_both); } else { name.setlocationrelativeto(null); } } i want ability name jframe type in parameters. @ moment, when type in string spits out error saying can't use string? want "name" string variable can type in string value , have object named that. edit: need make question more clear... packagename.setjframe("title of frame", 500, 800, f, false); returns error: exception in thread "main" java.lang.error: unresolved compilation problems: f cannot resolved f cannot resolved at gui.guimain.guiset(guimain.java:17) at urapackage.main.main(main.ja

objective c - Converting ObjC Blocks to C# Lambas -

i need converting objective-c block c#. here source objc: nsdate* addyear = [_calendar datebyaddingcomponents:((^{ nsdatecomponents* components = [nsdatecomponents new]; components.month = 12; return components; })()) todate:now options:0]; now tried following in c#: nsdate date = _calendar.datebyaddingcomponents((() => { nsdatecomponents components = new nsdatecomponents(); components.month = 12; return components; })(), now, nscalendaroptions.none); to following compiler error: expression denotes 'anonymous method' 'method group' expected . removing parentheses around lambda yields cannot convert 'lambda expression' non-delegate type 'monotouch.foundation.nsdatecomponents' . what correct c# syntax? need retain closures there lot more in code base porting. this should work: var date = calendar.datebyaddingcomponents ( new nsdatecom

java - Can't get Jersey mappings to work -

i new java, have started java coming php. i trying restful api , running jersey , tomcat. seem make mistake , cannot find post or thread same error message getting. grateful regarding issue, thanks! this maven dependencies <dependencies> <dependency> <groupid>org.glassfish.jersey.containers</groupid> <artifactid>jersey-container-grizzly2-http</artifactid> <version>2.9</version> </dependency> <dependency> <groupid>org.glassfish.jersey.containers</groupid> <artifactid>jersey-container-grizzly2-servlet</artifactid> <version>2.9</version> </dependency> <dependency> <groupid>org.glassfish.jersey.containers</groupid> <artifactid>jersey-container-jdk-http</artifactid> <version>2.9</version> </dependency> <dependency> <

javascript - Change html text based on node.js server setTimeout() -

how 1 change text of div string of text after period of time using node.js , settimeout function? the main caveat text should changed users @ same time. let's h2 title on index page "welcome page." 5 seconds later (after server time, not after time of request), h2 title should change "let's started." if request came in 6 seconds after server started, should see "let's started." , never see "welcome page." since h2 title should have been universally changed. any guidance hugely appreciated. here may try (express + socketio 1.0 example): server.js: var app = require('express')(); var server = require('http').createserver(app); var io = require('socket.io')(server); server.listen(80); var dir = __dirname; app.get('/', function(req, res) { res.sendfile(dir + '/index.html'); }); var header = 'welcome page.'; settimeout(function() { header = '

go - What does the &^ operator do? -

according specification operator called bit clear: &^ bit clear (and not) integers i've never heard of such operator before, , i'm wondering why useful. it seems take left operand , disables bits turned on in right operand. there formal description of operator? 1 more thing noticed it's not commutative. pseudocode in comarison ^ : 11110 &^ 100 //11010 11110 ^ 100 //11010 11110 &^ 0 //11110 11110 ^ 0 //11110 11110 &^ 11110 //0 11110 ^ 11110 //0 11110 &^ 111 //11000 11110 ^ 111 //11001 111 &^ 11110 //1 111 ^ 11110 //11001 from symbol (a concatenation of & , ^ ), name "and not" (and term "bit clear" sounds opposite of "bit set"), seems evident a &^ b doing a & ^b (where ^ bitwise inverse). this backed examining operator's truth table: fmt.println(0 &^ 0); // 0 fmt.println(0 &^ 1); // 0 fmt.println(1 &^ 0); // 1 fmt.println(1 &^ 1); // 0

c - Node in linked list appears to be empty when trying to print it -

so, here thing. have program stores different authors in linked list, each author has own records , each record holds texts, organized in linked list. data read file. here code: #include <stdio.h> #include <stdlib.h> #include <string.h> #include <stdbool.h> struct authorrecord { char texttitle[100]; int numberofwords; long download; struct authorrecord *next; }; typedef struct authorrecord *authorrecordtype; typedef struct { char firstname[30]; char lastname[30]; int idnumber; int textnum; authorrecordtype text; } authortype; struct membernodestruct { authortype *anauthor; struct membernodestruct *next; }; typedef struct membernodestruct *membernodetype; file* input; file* output; membernodetype head; membernodetype member; int main (void) { int authornum, textnum, i, j; member = malloc(sizeof(struct membernodestruct)); head = member; member->next = null; input = fopen("input.tx

html - css - Revert select to normal state when mouse is out -

html code: <select id="dict"> <option value="1">google.com</option> <option value="2">thefreedictionary.com</option> <option value="3">dictionary.reference.com</option> <option value="4">merriam-webster.com</option> <option value="5">macmillandictionary.com</option> <option value="6">oxforddictionaries.com</option> <option value="7">collinsdictionary.com</option> </select> css code: #dict { -moz-border-radius: 5px; -webkit-border-radius: 5px; border-radius: 5px; background-color: #eee; border-style: solid; border-color: #646464; padding-left: 1.5px; padding-right: 1.5px; margin-left: 0px; border-width: thin; width: 263.5px; } #dict:hover { border-color: #06f; color: #06f; } #dict:focus { outline: none; border-color: #093; color: #093; }

c - Flex, continuous scanning stream (from socket). Did I miss something using yywrap()? -

working on socketbased scanner (continuous stream) using flex pattern recognition. flex doesn't find match overlaps 'array bounderies'. implemented yywrap() setup new array content yylex() detects <> (it call yywrap). no success far. basically (for pin-pointing problem) code: %{ #include <stdio.h> #include <string.h> #include <stdlib.h> #define buffersize 26 /* 0123456789012345678901234 */ char cbuf1[buffersize] = "hello everybody, lex su"; // warning, no '\0' char cbuf2[buffersize] = "per cool. thanks! "; char recvbuffer[buffersize]; int packetcnt = 0; yy_buffer_state bufferstate1, bufferstate2; %} %option nounput %option noinput %% "super" { echo; } . { printf( "%c", yytext[0] );} %% int yywrap() { int retval = 1; printf(">> yywrap()\n"); if( packetcnt <= 0 ) // stop after 2 {

jquery - Uploading multiple images with captions (and other attributes if necessary) using AJAX in MVC 5 -

i trying create own light cms use in site having trouble ajax uploading multiple images , values associated them controller. here code. have newsitem: public class newsitem { public newsitem() ... public list<newsitemimage> images { get; set; } ... } and image item: public class newsitemimage { public int id { get; set; } [required] public string imagename { get; set; } [required] public byte[] image { get; set; } public string caption { get; set; } [required] public string imagemimetype { get; set; } public newsitem newsitem { get; set; } public int newsitemid { get; set; } public bool isdefaultimage { get; set; } } now, want able upload images, captions, etc, , associate them news item. association part fine (i tried when uploading images without information. model not working). html: <form id="uploader"> <label>choose images upload</label&g

ruby on rails - How to get all documents and hide this which are expired if they are defined? -

i want hide past events if defined , other. how show documents if :once_at nil , if :once_at defined hide these ones expired? my recent approach, shows events defined :once_at, (i tryed :once_at => nil, without results): default_scope where(:once_at.gte => date.today) or (also not working) default_scope excludes(:once_at.lte => date.today) when think date.today evaluated? if this: default_scope where(:once_at.gte => date.today) date.today evaluated when class being loaded. never want happen, want date.today evaluated when default scope used , usual way make happen use proc or lambda scope: default_scope -> { where(:once_at.gte => date.today) } the next problem documents don't have :once_at or explicit nil in :once_at . nil won't greater today you'd best check conditions separately :$or query: default_scope -> where( :$or => [ { :once_at => nil }, { :once_at.gte => date.today }

ruby - Rails 4: create custom object in controller -

i'm trying create provider oembed in rails 4 route, controller , action created. but i'm not able create object parameters needed oembed (e.g. type, version, html, ...) i trying way: class servicescontroller < applicationcontroller def oembed # project id url = params[:url].split("/") project_id = url[4] @project = project.find(project_id) html = render_to_string :partial => "projects/oembed", :formats => [:html], :locals => { :project => @ # here's problem: oembed_response["type"] = "rich" oembed_response["version"] = "1.0" oembed_response["title"] = @project.name oembed_response["html"] = html respond_to | format | if(@project) format.html { render :text => "test" } format.json { render json: oembed_response, status: :

MySQL select with Disitinct and Where with is_null? -

can please explain mysql query & does? as can understand following: select invoices_charge invoice id ’s without entry in invoice table. correct? select distinct invoice_charges.invoiceid invoice `invoice_charges` left join `invoice` on invoice_charges.invoiceid = invoice.invoiceid invoice.invoiceid null is there effect of keyword distinct in query? following query better alternative query achieve same result ? select invoice_charges.invoiceid invoice `invoice_charges` invoice_charges.invoiceid not in invoice.invoiceid group invoice_charges.invoiceid this query returning invoiceid s in invoice_charges have no match in invoice . presumably, these examples of failed foreign key relationship. the purpose of distinct prevent duplicates being in result set. have 2 records in invoice_charges same invoiceid , invoiceid not in invoice table.

multithreading - java : When memory returns in method? -

i know memory returns after function ends. when thread object returned? - when variable returned? public aaa () { int = 1; new thread() { public void run() { } }.start(); } sorry. when removed stack? after aaa() ends or thread ends? when thread object removed heap? i think "returned" poor choice of wording in question, , you're asking "when x removed heap?" - i.e. "when can memory allocated x reallocated else?" if that's case, you're asking called garbage collection , ongoing process java finds things can't use anymore - "garbage" - , removes them memory. simply put, something becomes "garbage" when becomes unreachable - when there no remaining references it. to use example think you're alluding to: void foo() { int = 1; //do stuff return; } each time foo() executes, memory space allocated new local variable a . each time finish

vb.net - length > 1 but only done once in for loop -

code : private sub refreshtodolist() handles mybase.load if fileexists(newevent.todoitems_path) , fileexists(newevent.tododates_path) , fileexists(newevent.todocontents_path) if not contentof(newevent.todoitems_path).tostring = "" , not contentof(newevent.tododates_path).tostring = "" , not contentof(newevent.todocontents_path).tostring = "" todolistitems = contentof(newevent.todoitems_path).tostring.split(new string() {environment.newline}, stringsplitoptions.none) todolistdates = contentof(newevent.tododates_path).tostring.split(new string() {environment.newline}, stringsplitoptions.none) todolistcontents = contentof(newevent.todocontents_path).tostring.split(new string() {environment.newline}, stringsplitoptions.none) end if if todolistitems.length = todolistdates.length , todolistitems.length = todolistcontents.length count integer = 0 todolistitems.length - 1

node.js - Mongoose {unique:true} validator not working properly -

i trying catch mongodb 11000 error in test application when 2 emails both same, each time newly created user added database , not seeing error logged console. new mongodb,express stack in general, may missing obvious. i receiving following error in mongod: background addexistingtoindex exception e11000 duplicate key error index: database.users.$email_1 dup key: { : "asdf@gmail.com" } 2014-06-02t01:52:34.654-0400 [conn10] index build failed. spec: { v: 1, unique: true, key: { email: 1 }, name: "email_1", ns: "database.users", background: true } error: 11000 e11000 duplicate key error index: database.users.$email_1 dup key: { : "asdf@gmail.com" } here defined schema: //***************************************** //define user schema var userschema = new mongoose.schema({ fullname: string, email: {type: string, unique:true}, password: string, createdon: date }); //define user model mongoose.model('user',userschema

How to initialize large size of array to 0 in C -

this question has answer here: problem initializing large double array 2 answers how initialize members of array same value? 17 answers i trying initialize columns , rows of array of large size 0, without using pointers in c. getting crash , shows error message 'not enough memory'. , don't want use pointers in application. i have local variable (inside function) defined this: double myarray[50][785190]={0}; i tried code above it's not working. i thought this, @ least in c++, not sure if/when added c. double myarray[50][785190]={{0}}; but, said you're getting out of memory errors. declaring 300meg on stack not idea. move global variable (outside of functions) , no longer on stack. or declare static . in either case code not reentrant glo

c++ - Invalid use of qualified name -

i'm trying following: #include <iostream> namespace { extern int j; } int main() { int a::j=5; std::cout << a::j; } but i've error: invalid use of qualified-name ‘a::j’ . please explain why error occurred? please explain why error occurred? the language doesn't allow define namespace-scope variables inside functions. definition has either in namespace a : namespace { int j = 5; } or in surrounding (global) namespace: int a::j = 5; you can, of course, assign value variable inside function: int main() { a::j = 5; // ... } but you'll need definition somewhere, since program doesn't have one.

javascript - Change content of one div when hovering on another in a different place -

please help, trying change content in 1 div when mouse on over image in div. im trying use this:- $(document).ready(function(){ // icons $('#iconone img').mouseover(function(){ $('#stop').css('display', 'inline-block'); }); $('#iconone img').mouseout(function(){ $('#stop').css('display', 'inline-block'); }); // box 2 $('#icontwo img').mouseover(function(){ $('#stop').css('display', 'none'); $('#shop').css('display', 'inline-block'); }); $('#icontwo img').mouseout(function(){ $('#stop').css('display', 'none'); $('#shop').css('display', 'inline-block'); }); // box 3 $('#iconthree img').mouseover(function(){ $('#stop').css('display', 'none'); $('#shop').css('display', 'none'); $('#select').css('display&#

Updating python on redhat linux server -

this question has answer here: change default python version 2.4 2.6 6 answers i downloaded , installed python 2.7.6 manually on redhat linux server have trouble making default python version, still uses old python 2.4.3 should make python 2.7.6 default. add: export path=/path/to/2.7.6/bin:$path .bashrc file.

Node.js mongodb cursor.each get empty, can't run in sequence -

server.get('/getlist', function (req, res, next) { db.collection('lists',function(error, collection) { var gets = []; var cursor = collection.find({status: 1}); var = 0; cursor.each(function (err, docs) { console.log(docs); gets[i] = docs; = + 1; }); res.send(gets); }); return next(); }); it can log out correctly, website " http://127.0.0.1:8080/getlist " result empty "[]". how make cursor.each run in sequence every source code line? or there better solution? you use toarray convert cursor array: cursor.toarray(function(err,documents){ res.send(documents); next(); });

dynamodb: how to filer all items which do not have a certain attribute? -

i have table of users primary hash key of userid. each user may/may not have string attribute called "environment". users have "environment"="xyz" or not have "environment" attribute. the following code filter users environment=xyz, how filter items no environment @ all? dynamo api not allow filter on empty string. amazondynamodbclient client = dbclientmanager.getdynamodbclient(); arraylist<attributevalue> avlist = new arraylist<attributevalue>(); avlist.add(new attributevalue().withs("xyz")); condition scanfiltercondition = new condition() .withcomparisonoperator(comparisonoperator.eq.tostring()) .withattributevaluelist(avlist); map<string, condition> conditions = new hashmap<>(); conditions.put("environment", scanfiltercondition); scanrequest scanrequest = new scanrequest() .withtablename("users") .withatt

xslt - check for the following node -

i've small question in xslt. need xpath validate condition. , below xml. <root> <para> erlanger , several associates formed syndicate acquire lease of island in west indies &#x00a3;55,000. idea mine <page num="44"/>island phosphates. </para> <para> <content-style font-style="bold">2.25</content-style> commission or payment promoter receives upon transfer of property company must disclosed. <para> board nominees of green , smith; <page num="45"/>accordingly, disclosure </para> </para> <para> <content-style font-style="bold">2.26</content-style> if promoter contracts company whether vendor<footnote num="57" id="fn57"> <para> <case> <casename> <content-style font-style="italic">re leeds &#x0026; hanle

Jenkins Xcode-Plugin Can't Find SDK (Unit Testing) -

Image
i'm using xcode-plugin on jenkins run unit tests , generate result output in ios application. although build completes normally, when gets point of executing test portion fails following error: going invoke xcodebuild:target: funtests, sdk: /developer/platforms/iphonesimulator.platform/developer/sdks/iphonesimulator5.0.sdk/, project: default, configuration: debug, clean: no, archive:no, symroot: default, configurationbuilddir: default, codesignidentity: default [workspace] $ /usr/bin/xcodebuild -target funtests -sdk /developer/platforms/iphonesimulator.platform/developer/sdks/iphonesimulator5.0.sdk/ -configuration debug build xcodebuild: error: sdk "/developer/platforms/iphonesimulator.platform/developer/sdks/iphonesimulator5.0.sdk/" cannot located. build step 'xcode' marked build failure archiving artifacts finished: failure here's screen capture of settings: i've entered correct path sdk, no dice. i'm guessing simple i'v