Posts

Showing posts from May, 2011

javascript - How to add request headers when uploading a file using iframe? -

my form should upload file , should work older versions of ie. that's why use hidden iframe. thing need add couple of headers request required 3rd party api i'm using. how set request headers when using iframe? you cannot. xmlhttprequest api browsers provide allows setting of http headers javascript.

java - Convert Map to ArrayList where entry value = something -

i using map<user, integer> , need select users specific integers , add them arraylist, easiest way users arraylist<user> integer = 1? this tried, works, appreciate shorter code. arraylist<user> users = new arraylist(); (map.entry<user, integer> entry : useranswers.entryset()) { if(entry.getvalue()==1) users.add(entry.getkey()); } edit: thank danil gaponov, answer looking for! requires java 8: map.entryset().stream() .filter(e -> e.getvalue().equals(1)) .map(e -> e.getkey()) .collect(collectors.tolist());

How to access external usb camera on unrooted android devices -

i want access extern usb cameras via v4l on android. i tried simplewebcam . after slight modifications of original source codes, achieved make work on rooted android device. however, on unrooted devices, keeps complaining "not have permission access "/dev/video*". checked permission of /dev/video* "ls -l /dev/video*", , got crw-rw---- system camera 81, 0 2015-08-18 18:31 video0 i understand means /dev/video* owned system, , readable/writable users in group "camera". think if add <uses-permission android:name="android.permission.camera" /> in manifest of app, user id of app added group "camera", app allowed read data /dev/video*. but, still complains "not have permission access /dev/video*" now. i tried <uses-permission android:name="android.permission.camera" /> <uses-feature android:name="android.hardware.camera" /> <uses-feature android:name="and

database - How to set up a server for android app? -

i trying create android application in user pretty save data in database-like user data, photos , able retrieve. but clueless how set server, connect database etc. can me point right resources end-to-end installation of server, database, , interaction android application just set basic server works on http, , use http libraries android make requests , handle results in device. there plenty of technologies make server, google building rest api php/.net/java (whichever language comfortable with).

openerp - Tasks in Kanban View: card rearrangement error when Project/User is only authorized to modify his own tasks -

Image
this happens when project/user drops task unto destination stage containing tasks not owned him. apparently, odoo remembers stack ordering of tasks within stage via project.task.sequence , , updates task cards' sequence fields when project/user completes drop action. since project/user not authorized modify other users' tasks (of project.task object type). odoo server raises exception shown below. access restriction implemented via following record rule project/user: name: project/task: assignee , creator can modify task object: task (project.task) apply for: write domain filter: ['|',('user_id','=',user.id),('create_uid','=',user.id)] group name: project/user is there workaround problem? at time of writing, error can reproduced @ http://demo.odoo.com running odoo version 8.saas~6. note default human resources / employees allowed modify tasks not assigned them, write , delete access of record rule "project/task

c# - MongoDb Search in Document's Collection returns only fully matched result - Why? -

i'm trying locate user username , password match. have office collection each office document contains many users var builder = builders<mnoffice>.filter; var filter = builder.anyeq(o => o.users, new officeuser() { username = username, password = password }); var office = await offices.find(filter).firstordefaultasync().configureawait(false); return office; the above query returns null. although should result back. officeuser class has 3 properties, username, password, , name. mongo forces me 3 properties match in query, want have 2 properties matching (usename , password) in order result back, how can accomplish that? no documentation that. thanks! var filter = builder.elemmatch(o => o.users, user => user.username == username && user.password == password); solved using elemmatch, still dont understand logic behind first attempt.

javascript - Implementing d3-2way-tree for multilevel tree -

i referring d3 widget, d3 2 way tree . want tree grown further more both @ top , bottom, not able form json data it. in following json, added 2 nodes parents , 2 nodes children : { "name": "airlines", "parents": [ { "name": "aviation", "isparent": true }, { "name": "transparent_companies", "isparent": true }, { "name": "transport_operators", "isparent": true, "parents": [ { "name" : "parent-foo1", "isparent" : true }, { "name" : "parent-foo2", "isparent" : true } ] } ], "childre

html - Back Button with Javascript in Jira Velocity -

i developing velocity template our jira instance. thereby, inserted button go 1 page back. unfortunately javascript inserted nothing happens. code wrong? have consider special? <!-- button --> <span style="align:right"> <button id="description-back-button", onclick="goback()", class="aui-button">back icockpit </button> <script> function goback() { window.history.back(); } </script> </span> </div> thanks lot help! use instead of <button></button> . correct problem <input type="button" value="back icockpit" class="aui-button" onclick="window.history.back();" id="description-back-button">

javascript - how to use jquery .append() in a JS FOR loop? -

this question has answer here: access / process (nested) objects, arrays or json 16 answers ok have function success: function (data) { $('#chat').val(data); (var = 0, < data.length, i++) { $.append("#id: " + "#mesaage"); } } in data variable holds json array displayed this: {id: message} how can give format print "id: message" without curly brackets? you can make use of object.keys here: success: function (data) { var key = object.keys(data) $('#chat').val(key +":"+ data[key]); }, a sample test below: var data = {"id":"message"}; var key = object.keys(data); $(document.body).append(key +":"+ data[key]); <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>

database - Too many WAL archive file created in postgres -

i have configured file base - log shipping replication in postgresql 9.4. have default checkpint after every 5min , wal size of 16mb. however, postgresql send 16mb of file after every 1sec. normal? feel it's of network traffic. there way improve apart zipping logs? how control log shipping frequency ? in advance ! sent 16779372 bytes received 31 bytes 11186268.67 bytes/sec total size 16777216 speedup 1.00 sending incremental file list 000000010000002d00000065 sent 16779372 bytes received 31 bytes 11186268.67 bytes/sec total size 16777216 speedup 1.00 sending incremental file list 000000010000002d00000066 i realized archive_timeout set 10 sec. hence creating many wal file copies. updated archive_timeout = 60 make sure archive wal segment after 1 min.

user interface - Jump back to previously edited line/word within word document -

Image
while editing / reviewing large word document (doc/docx) document, searching way jump edited text or line couldn't find button enabling me so. has solution this? you can use predefined commands "next edit" , "previous edit". can example add these commands in 1 of tabs of ribbon. for this, right-click ribbon , select "customize ribbon..." select chhose command "all commands" , use right-hand side define buttons commands shall placed:

c# - Button with a CheckBox -

Image
we have requirement create button checkbox embedded in it. after trying various option, found option of having checkbox appearance of button not suffice need have event being fired when button being clicked checkbox.checked state used other modifications. can guide me on how proceed task? if want can this: checkbox1.parent = button1; // make large enough checkbox1.location = new point(5, (button1.height - checkbox1.height) /2 + 1) ; checkbox1.textalign = contentalignment.middleleft; button1.textalign = contentalignment.middleright; make sure set texts , alignments both prevent clashes. make sure test if act intended..! you can place button wherever want, align right or clear text .. of course can wrap in class, if need repeatedly..

angularjs checkbox ng-checked not working -

i have following code :- <!doctype html> <html lang="en"> <head> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css"> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.4/angular.min.js"></script> </head> <body ng-app="app" ng-controller="ctrl" ng-init="init()"> <div class="container" style="width:400px"> <div class="panel panel-default"> <div class="panel-body"> <form> <div class="form-group"> <label for="selectedbasket">select basket :</label> <select id="selectedbasket" class="form-control" ng-model="selectedbasket" ng-options="b.name b in baskets"> </select>

ios - Swift Async Imageloader -

i implement tableview cells display image. images loaded asynchroniously. better scrolling want request canceled if cell scrolls out of view. code far works, don't know how detect if cell visible or "scrolled over". here's code: func tableview(tableview: uitableview, cellforrowatindexpath indexpath: nsindexpath) -> uitableviewcell { let cell = tableview.dequeuereusablecellwithidentifier("eventstablecell", forindexpath: indexpath) as! eventstablecell var elem : event = data[indexpath.row] event cell.headlinelabel.text = elem.getname() cell.secondlabel.text = elem.getdescription() cell.progressview.setprogress(0.0,animated: true) if let image = imagecache.getimage(elem.getid()) { cell.coverimage.image = image cell.progressview.removefromsuperview() } else { cell.coverimage.image = uiimage(named: "loading") if(elem.getcover() == nil){ //noimage cell.p

In Sesame, how does one derive RDFS/OWL materialization results that have an RDF literal in the subject position? -

i have problem rdfs entailment in sesame 2.8.5 . want automatically deduce (3) (1) , (2) (using turtle notation here). defined rule rdfs3 in the rdf 1.1 specification , rule prp-rng in the owl-rl specification . (1) foaf:givenname rdfs:range xsd:string . (2) ex:wouter foaf:givenname "wouter" . (3) "wouter" xsd:string . i have implemented in sesame using forwardchainingrdfsinferencer class follows: public static void main(string[] args) throws repositoryexception, rdfhandlerexception { repository r = new sailrepository(new forwardchainingrdfsinferencer(new memorystore())); r.initialize(); valuefactory f = r.getvaluefactory(); repositoryconnection c = r.getconnection(); try { c.add(foaf.given_name, rdfs.range, xmlschema.string); c.add(f.createuri("http://example.org/", "wouter"), foaf.given_name, f.createliteral("wouter", xmlschema.string)); repositoryresult<statement&g

excel - Ignore empty cells in for each VBA -

i having problem loop(i go throu columns in every worksheet , copy them common column ) in vba. , wan't ignore empty cells... ideas? bellow code application.screenupdating = false lastrowmaster = 1 each ws in sheets(array("1l", "5l")) lastrow = ws.range("a" & rows.count).end(xlup).row ws.range("a1:a" & lastrow).copy destination:=worksheets("podatki plana").range("a" & lastrowmaster) lastrowmaster = worksheets("podatki plana").range("a" & rows.count).end(xlup).row + 1 next application.screenupdating = true msgbox "done!" i altered line of code: ws.range("a1:a" & lastrow).copy destination:=worksheets("podatki plana").range("a" & lastrowmaster) to this: ws.range("a1:a" & lastrow).specialcells(xlcelltypeconstants).copy destination:=worksheets("podatki plana").range("a

Convert/access JSON file like DOM in JavaScript without jQuery? -

i want know how convert or access json file dom in javascript without using jquery. for example, in json {"u1" : "a":1 ,"b":5 ,"c":8 } how apply dom output this? if desired structure: var myobject = {"u1": {"a": 1,"b": 5, "c": 8 }}; alert(myobject.u1.a);

python - unicode decode error for weasyprint -

i try , use weasyprint prepare pdf, , string, following error. decode string unicode before feeding weasyprint. suggestions? 'utf8' codec can't decode byte 0xc2 in position 0: unexpected end of data request method: django version: 1.6.2 exception type: unicodedecodeerror exception value: 'utf8' codec can't decode byte 0xc2 in position 0: unexpected end of data exception location: /usr/lib/python2.7/encodings/utf_8.py in decode, line 16 python executable: /usr/bin/python python version: 2.7.6 python path: unicode error hint the string not encoded/decoded was: � traceback switch copy-and-paste view /usr/local/lib/python2.7/dist-packages/weasyprint/__init__.py in write_pdf return self.render(stylesheets).write_pdf(target, zoom, attachments) ... /usr/local/lib/python2.7/dist-packages/weasyprint/__init__.py in render return document._render(self, stylesheets, enable_hinting) ... /usr/local/lib/python2.7/dist-packages/weasyprint/docume

Insert node in xml document using c# -

i trying insert xml node in xml document @ specific position. this xml: <envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/"> <body> <readcontract xmlns="http://implementation.company.schema.reference"> <contactnumbers>10158</contactnumbers> <productgroups>0085</productgroups> <indicationbalanceinfo>false</indicationbalanceinfo> <indicationblocked>true</indicationblocked> </readcontract> </body> </envelope> and trying insert tag <productgroups>0093</productgroups> below tag <productgroups>0085</productgroups> expecting below: <envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/"> <body> <readcontract xmlns="http://implementation.company.schema.reference"> <contactnumbers>10158</contactnumbers

playframework - When I uploading data, doubles fields Play framework -

i don't know why, when calling save method, fields come me "title, title", "body, body". why happening? here method: public static void save(news news, file img) { if (img != null) { try { fileutils.deletedirectory(new file(news.imagepath)); string projectroot = play.configuration.getproperty("my.file.path"); string filename = string.format("%s.%s",randomstringutils.randomalphanumeric(8), "jpg"); fileutils.movefile(img, new file(projectroot, filename)); news.imagepath = projectroot + filename; } catch (ioexception e) { e.printstacktrace(); } } news.createdate = new date(); system.out.println("save" + news.id + " " + news.title); news.save(); news(); } and in html file call method parameters mews , img : #{extends 'main.html' /} <meta char

android - Change screen orientation in a Unity Google Cardboard project -

i'm starting cardboard project it's joyful experiment vr without huge hardware, have little problem sounds basic : screen orientation. have game playable in landscape right instead of left i'm developing on xperia z. usually screen orientation's problems solved forcing orientation through player's settings in build menu. here, fact when tick "landscape right" box instead of left 1 (which default setting of cardboard api) correctly inverts display camera stays @ same orientation before. results gyroscope works in reverse , ground seen on top, texts reversed well. i've done eldir tried here ( google cardboard device orientation ) wasn't same problem i'm having, wasn't efficient. do have ideas if api allows quick change this, or if have modify whole parameters of gyroscope ? thanks !

c# - Method not found: 'Void System.Diagnostics.Tracing.FrameworkEventSource.BeginGetResponse(System.Object, System.String)' -

i upgraded windows 8.1 today. after upgrade experiencing following exception on 1 of wpf windows: xaml exception: provide value on 'system.windows.baml2006.typeconvertermarkupextension' threw exception . inner exception: method not found: 'void system.diagnostics.tracing.frameworkeventsource.begingetresponse(system.object, system.string)'. i not getting exception before updating windows. note when remove icon window exception not occur - icon="/myprogram;component/resources/language.png" unhandled stack trace follows: framework version: v4.0.30319 description: process terminated due unhandled exception. exception info: system.windows.markup.xamlparseexception stack: @ ms.internal.threading.exceptionfilterhelper.trycatchwhen(system.object, system.delegate, system.object, int32, system.delegate) @ system.windows.threading.dispatcheroperation.invokeimpl() @ system.windows.threading.dispatcheroperation.invokeinsecuritycontext(system.obj

xamarin - When I'm deploying ios app to simulator, it is not showing me complete screen -

Image
when i'm deploying ios app simulator, not showing me complete screen. i've configure proper launch images. simulator size (3.5") what's happening because monitor not retina display , device simulating takes more space on monitor (notice scroll bars). you can scale simulator can see @ once without scrolling clicking on window > scale > percentage want . aside scrolling issue, if actual content doesn't display need either place in scroll view or set constraints handle different screen sizes.

c# - How to extract data based on timestamps in multiline log? -

i have logs have data in format below. question - lets search log 12:22 pm , how can extract information pertaining time-stamp , output it... there way can output 12:22 pm onwards until hit next time-stamp? thats want programmatically. appreciated. thank you! 12:22 pm abc def ghi abc 12:33 pm abc def the output above mentioned case - 12:22 pm abc def ghi abc also please note: there multiple log entries same timestamp, example, there 2 or 3 or maybe more entries under same timestamp, i.e, 12:22 pm you can write static function extract required log given timestamp below: note : i'm not handling exception scenario's[like filenotfoundexception , other exceptions], please handle them per requirement. static string getlogsbytimestamp(string timestamp) { if (!string.isnullorempty(timestamp)) { string filepath = @"f:\log.txt"; //your logfile path here

Stack overflow error in Java recursion -

i'm trying implement code returns sum of prime numbers under 2 million. have isprime(int x) method returns true if the number prime. here is: public static boolean isprime(int x) { (int = 2; < x; i++) { if (x % == 0) { return false; } } return true; } and other method, i'm trying implement recursively, works until number, on number , stack overflow error. highest got code work 10,000. here is: public static int sumofprimes(int a) { if (a < 2000000) { //this limit if (isprime(a)) { return + sumofprimes(a + 1); } else { return sumofprimes(a + 1); } } return -1; } so why stack overflow error when number gets bigger , how can deal this? also, how deal writing code such big numbers? ie: normal number operations larger numbers? wrote recursively because thought more efficient still wont work. your isprime function inef

vba - Filter Subform, Starts With, Multiple criteria -

i filter subform based on data put text box. code below show record if student id typed perfectly. want have filter show records in student id , first name or last name starts me.sort.text private sub sort_change() if isnull(me.sort.text) or me.sort.text = "" me.students_subform.form.filteron = false else me.students_subform.form.filteron = true me.students_subform.form.filter = "[student id] ='" & me.sort.text & "'" end if end sub it sounds me need filter expression 3 like conditions or 'd together. for example if me.sort.text contains text "foo" , build filter expression string such ... "[student id] 'foo*' or [first name] 'foo*' or [last name] 'foo*'" i tested code in access 2010 , filters subform think want ... private sub sort_change() dim strfilter string me.sort if len(.text & vbnullstring) > 0 strfilter = &q

spring - Activemq degrade response time -

i`m using activemq 5.10 spring 4.1.1. find degrade problem response time of messages. after 4 days, response time starts grow 15ms 200ms , more. app works fine approximately 1000 messages per second , run slower. here part of xml beans: <amq:systemusage> <amq:memoryusage> <amq:memoryusage limit="512 mb"> </amq:memoryusage> </amq:memoryusage> <amq:storeusage> <amq:storeusage limit="50 mb"></amq:storeusage> </amq:storeusage> <amq:tempusage> <amq:tempusage limit="50 mb"></amq:tempusage> </amq:tempusage> </amq:systemusage> <amq:broker brokername="mybroker" id="broker" persistent="false" deleteallmessagesonstartup="true" enablestatistics="false" useloggingfors

c++ - Producing JSON from C#: WebMessageBodyStyle.Wrapped or WebMessageBodyStyle.Bare? -

i trying write c++ application, using c++ rest sdk lib, process json data produced c# application. c# program can produce json in "wrapped" or "bare" style. using bodystyle = webmessagebodystyle.wrapped , c# produces json following: {"echo":"{\"firstname\":\"an'",\"number\":21,\"secondname\":\"pn\"}"} using bodystyle = webmessagebodystyle.bare , c# produces json this: "{\"firstname\":\"an'",\"number\":21,\"secondname\":\"pn\"}" how can program recognize type produced: wrapped or bare ? json standard format representing, , exchanging, data. not define terms wrapped or bare . not familiar c# , libraries encoding data json, can make guess based on samples provided. if have control on c# application, code use bare only. see no advantage, in general, wrapped style. perhaps designed other c# client libr

sql - Insert query results into temp table -

i've learned here how pivot in sql, , took example other question on here. works perfectly. however, want perform additional joins, after query, unable insert temporary table results of query? how may that? create table create table yt ([store] int, [week] int, [xcount] int) ; insert yt ([store], [week], [xcount]) values (102, 1, 96), (101, 1, 138), (105, 1, 37), (109, 1, 59), (101, 2, 282), (102, 2, 212), (105, 2, 78), (109, 2, 97), (105, 3, 60), (102, 3, 123), (101, 3, 220), (109, 3, 87); perform pivoting query declare @cols nvarchar(max), @query nvarchar(max) select @cols = stuff((select ',' + quotename(week) yt group week order week xml path(''), type ).value('.', 'nvarchar(max)') ,1,1,'') set @query = 'select store,' + @cols + ' ( select store, week, xcount yt ) x pivot (

sitecore - Solr auto complete with ngram ignore spaces and upper latters -

i have title string fields: word 111 word 222 word xyz word ynx i have next settings in solr index it <fieldtype name="auto_complete" class="solr.textfield" positionincrementgap="100"> <analyzer type="index"> <tokenizer class="solr.standardtokenizerfactory" /> <!-- <filter class="solr.stopfilterfactory" ignorecase="true" words="stopwords.txt" /> --> <filter class="solr.worddelimiterfilterfactory" generatewordparts="1" generatenumberparts="1" catenatewords="1" catenatenumbers="1" catenateall="1" splitoncasechange="1" splitonnumerics="1" preserveoriginal="1" /> <filter class="solr.lowercasefilter

javascript - My .onclick function for a child list only display for a split second - Jquery -

i'd make list that's nested within list collapse on click, sub-menu department. real flashy like. i'm using .click function having hid sub-menus, showing slight second. i'm super novice , began using jquery last week. here code: jquery: $(function(){ $("ul.sitback").hide(); }); $(function() { $("li.dept").click(function(){ $("ul.sitback").toggle(); }); }); html: <h3 align="center">departments</h3> <ul> <a href><li class="dept1">+ take care products</li></a> <ul id="area1" class="sitback"> <a href><li>men's products</li></a> <a href><li>women's products</li></a> </ul> <a href><li class="dept">+ home electronics</li></a> <ul id="area" clas

symfony - @mailer and @twig in argument of a service error ServiceCircularReferenceException -

i'm trying put twig argument of service have same error : servicecircularreferenceexception in bootstrap.php.cache line 2129 circular reference detected service "doctrine.orm.default_entity_manager",path: "doctrine.orm.default_entity_manager -> doctrine.dbal.default_connection -> wh.participant_listener -> wh.participant_notification -> twig -> security.authorization_checker -> security.authentication.manager -> fos_user.user_provider.username -> fos_user.user_manager".` this service.yml file wh.participant_notification: class: wh\trainingbundle\notification\notification arguments: [@mailer, @twig] wh.participant_listener: class: wh\trainingbundle\eventlistener\participantlistener arguments: [@wh.participant_notification] tags: - { name: doctrine.event_listener, event: postupdate } - { name: doctrine.event_listener, event: postpersist } my partcicipantlistenerfile namespace wh\trainingb

java - How to prevent imports of packages from all classes except one class? -

i migrate code common collection 3 common collection 4 after migration want prevent imports of common collection 3 packages in classes except 1 class. (unfortunately not have time migrate class). i have found can not find how configure exclude list: http://checkstyle.sourceforge.net/config_imports.html#illegalimport is possible configure checkstyle exclude classes? other tools can it? if ok configuring checkstyle rules achieve this, need use more complex option (illegalimport has 1 parameter - illegalpackage): importcontrol .

java - Float as key in map -

given collection of {price, quantity} pair, need aggregate quantities @ same price point. easiest way achieve it? a dirty-cut, implement solution using hashmap keys being price , value being aggregated quantity. but, in knowledge, float isn't safe key hashmap . solution error-prone. what recommended alternative solve problem? you use bigdecimal key. hashcode safe. you'd have initialize values have same scale, instance: bigdecimal key = new bigdecimal(double.tostring(price)).setscale(2);

c# - if else if in while loop were else if test is defined in the first cycle -

somewhat confusing, when trying describe in title. here's example code. i'm hoping possible (i haven't found way yet.) datetime starttime = datetime.now; int = 0; bool running = true; while (running) { datetime? lastruntime = null; if (i == 0) { if ((datetime.now - starttime).minutes >= program.gentimer) { = 1; lastruntime = datetime.now; } } else if ((datetime.now - lastruntime).minutes >= program.gentimer) { //doestuff } this looks foolish (and not work @ all, obvious being nullable timespan doesnt contain definition 'minutes. i've tried datetime lastruntime; instead of datetime? lastruntime = null; so i'm forcing first if statement true first time , false every pass afterward. i'm open different approach. if you

rspec - Capybara have_selector is not working -

on view have checkbox <input type="checkbox" id="modal-checkbox" class="painter-modal-checkbox" data-reactid=".1.1:1.0.0"> on capybara code trying use have_selector method expect(page).to have_selector("#modal-checkbox") this fails, when tracing page print page.html i can confirm html code there, why test fails. this because field isn't visible because it's hidden via css. checkboxes because design calls label used show selected state of checkbox while actual checkbox hidden. check if visibility issue can pass visible: false have_selector, 99% of time shouldn't checking invisible items since user wouldn't able see them or interact them

java - Tomcat returns a 404 page using Spring MVC; controller not reached -

i have controller , jsp. all. export project .war , put in tomcat webapps directory running on linux mint. when type localhost:8080/filename address bar, returns tomcat 404 message. controller: package web.controllers; import java.util.random; import org.springframework.stereotype.controller; import org.springframework.ui.model; import org.springframework.web.bind.annotation.requestmapping; import org.springframework.web.bind.annotation.requestmethod; @controller @requestmapping(value = "/") public class homecontroller { @requestmapping(method = requestmethod.get) public string displayhomepage(model model) { model.addattribute("display",new random().nextint()); return "/index"; } } index.jsp : <%@ page contenttype="text/html" pageencoding="utf-8"%> <!doctype html public "-//w3c//dtd html 4.01 transitional//en" "http://www.w3.org/tr/html4/loose.dtd"> <

c# - Enable Migrations in MVC throws File not Found Error -

i'm new using mvc, , when working through tutorials regarding migrations in visual studio 2013 appear have broken tie-in entityframework in package manager console. i believe started when updated entityframework version 6.1.3, appears incompatible mvc controller scaffolding. rolled version 5.0.0. when enter command enable-migrations i following error: exception calling "createinstancefrom" "8" argument(s): "could not load file or assembly 'entityframework, version=5.0.0.0 , culture=neutral, publickeytoken=b77a5c561934e089' or 1 of dependencies. system cannot find file specified." @ d:\ss\cap\cap_mvc_dev_2\cap_mvc\packages\entityframework.5.0.0\tools\entityframework.psm1:431 char:31 + $domain.createinstancefrom <<<< ( + categoryinfo : notspecified: (:) [], methodinvocationexception + fullyqualifiederrorid : dotnetmethodtargetinvocation the file entityframework.psm1 e

nAudio WAV to MP3 muLaw error -

i grabbing wav file (successfully) via web service , able play on windows 7 machine. need grab same wav file , convert mp3 file. failing. have tried retrieving file wav (above) using -- wavestream pcmstream = waveformatconversionstream.createpcmstream(reader); to convert mulaw pcm. this failing attached error. have tried converting directly using lamemp3filewriter fails telling me "mulaw format cannot converted mp3. what missing? coder snippet private void writemp3(string inum, string callid) { //construct replay url using inum string url = "http://" + _verintserver + "/searchapi?command=replay&id=" + inum; // name new mp3 file string mp3file =_basepath + "mp3\\" + callid + ".mp3"; string tempwav = _basepath + "mp3\\" + callid + ".wav"; string temppcm = _basepath + "mp3\\" + callid + "_pcm.wav"; /

amazon s3 - Proper way to name objects in mass storage service -

i wonder 1 of personal projects development goes further forward how should organize files ( images, videos, audio files ) uploaded users onto aws's s3/gce cloud storage, i'm used see these kinds of url below; facebook fbcdn-sphotos-g-a.akamaihd.net/hphotos-ak-xft1/v/t1.0-9/11873531_1015...750483_5263546700711467249_n.jpg?oh=b3f06f7e...b7ebf7&oe=56392950&__gda__=1446569890_628...c7765669456 tumblr 36.media.tumblr.com/686b47...e93fa09c2478/tumblr_nt7lnyp3ld1rqbl96o1_500.png twitter pbs.twimg.com/media/cmimixsv...aczem.jpg does these random characters carry kind of meaning? or they're "uuids"? there performance/organization issue in using, instance kind of url below? content.socialnetworkx.com/usery/post/customname_dinosaurs.jpg edit: let clear i'm considering millions of files. for s3, see performance considerations page talks object naming. specifically, if plan upload objects @ high rate, should avoid sequentially named object

c++ - How to determine whether a 32-bit/64-bit value has a certain 16-bit value? -

questions consider following 32-bit , 64-bit values: uint32_t ival32 = 0x ab cd 12 34; uint64_t ival64 = 0x ab cd 12 34 56 78 ca be; how determine whether ival32 contains 16-bit (word) value? let's 0xcd12 . how determine whether ival64 contains 16-bit (word) value? let's 0x3456 . update 1 (added later) 0xcd12 word value checked might anywhere in ival32 in every word boundary. 0x3456 word value checked might anywhere in ival64 in every word boundary. update 2 (added later) i admit ridiculous mistake in question. in previous example, word values checked not in word boundaries in ival32 , ival64 . therefore, correction are: for ival32 , word value checked can either 0xabcd or 0x1234 . thus, example, 0xcd12 shouldn't found in ival32 . for ival64 , word value checked can 1 of following: 0xabcd or 0x1234 or 0x5678 or 0xcabe . thus, example, 0xcd12 or 0x3456 or 0x78ca shouldn't found in ival64 . remarks solutions intended us

javascript - How to manipulate arrays with a custom function -

so have array each cell of array containing specific function. var randomly = [ function(a) { return * - a; }, function(a) { return (a - 2) * (a - 1) * (a - 1); }, function(a) { return * + a; }, function(a) { return % 3; } ]; i'm creating function that takes input value (a) entire array , goes through each array cell individually, solves function. however, result of function becomes next function's input value. initial input value first function, , next function's input falue previous function's result. to this, created loop... var thefunction = function (input, queue){ (var = 0; < queue.length; i++){ queue[i](input); } so, here i'm stuck... how can call specific array along input value? used queue[i](input); not sure if that's valid. on appreciated. you're close, "chain" functions, you'll need store return values, can re-use them: var thefunction = function (input, queue) { var result = inpu

powershell - What is wrong with my array? -

i cannot figure out need fix script run. the code: $clusternodenames = (get-clusternode -cluster clu05).name $allvmsincluster = get-vm -computername $clusternodenames $allvms = $allvmsincluster | select -expandproperty name $allvmsincluster[1] | set-vm -snapshotfilelocation c:\clusterstorage\volume1\$allvms[1] what happening creating 2 arrays $allvmsincluster $allvms output of: ps c:\windows\system32> $allvmsincluster[1] name state cpuusage(%) memoryassigned(m) uptime status version ---- ----- ----------- ----------------- ------ ------ ------- acd-pv06 saved 0 0 00:00:00 operating 8.0 ps c:\windows\system32> $allvms[1] acd-pv06 my end game put last line in loop @ end keep getting whole array. when run last line change snapshotfilelocation acd-pv06 output looks like: c:\clusterstorage\volume1\acd-pv02 acd-pv06 acd-sql01-ag acd-sql02-ag[1] how can like: c:\clusterstorage\volume1\acd-pv06\

java - IllegalArgumentException: Bound must be positive -

i error saying bound must positive. here line on: inv.setitem(i, items.get(r.nextint(items.size()))); as far know, comes part request random integer list of items. how defined list: list<itemstack> items = getallitems(level); where getallitems() method looks like: public list<itemstack> getallitems(int level) { list<itemstack> items = new arraylist<itemstack>(); (string item : settings.getchests().getstringlist("chestitems." + level)) { itemstack toadd = parseitem(item); items.add(toadd); } return items; } i stacktrace: [19:03:53 error]: error occurred while enabling kitpvp v0.5 (is date?) java.lang.illegalargumentexception: bound must positive @ java.util.random.nextint(unknown source) ~[?:1.8.0_51] @ me.iamguus.gamegetsiepunt.kitpvp.chests.chestsutil.randomlyfillinv(chestsutil.java:101) ~[?:?] @ me.iamguus.gamegetsiepunt.kitpvp.main.onenable(main.java:40) ~[?:?] @ org.

r - Write latex equation inside knitr chunks -

i trying write equation inside chunk. need use '\sum' r not accept it. got error: '\s' unrecognized escape in character string i tried packages without success. how can bay pass escape character? here example: \documentclass{article} \begin{document} <<results='asis',echo=false>>= #library(lazyweave) #library(hwriterplus) #hwritelatex(as.latex("\bar{r}_{i}=\frac{\sum_{t=1}^{t}{r_{i,t}}}{8}")) # cat('\bar{r}_{i}=\frac{\sum_{t=1}^{t}{r_{i,t}}}{8}') #cat("$$","\bar{r}_{i}=\frac{\sum_{t=1}^{t}{r_{i,t}}}{8}","$$",sep="") cat("typically want our paragraphs left justified. expect see when reading.") @ \end{document} edit. read similar examples no 1 involved escape characters. you need double escape character. > cat('\\bar{r}_{i}=\\frac{\\sum_{t=1}^{t}{r_{i,t}}}{8}') \bar{r}_{i}=\frac{\sum_{t=1}^{t}{r_{i,t}}}{8}>

php - Strict standards error on joomla template installation -

i trying install joomla template following error ( ! ) strict standards: declaration of rokinstaller::getinstance() should compatible jinstaller::getinstance($basepath = 'c:\wamp\ww...', $classprefix = 'jinstaller...', $adapterfolder = 'adapter') in c:\wamp\www\joomla\tmp\install_55d4bc62ca9d1\business001_final\installer\rokinstaller.php on line 365 i have joomla 3.4.3, can me pass issue please. thanks guys you can turn off reporting of strict warnings editing php.ini , changing parameter error_reporting use wampmanager menu make sure edit correct php.ini file wampmanager -> php -> php.ini find line error_reporting = e_all and change to error_reporting = e_all & ~e_strict

javascript - Saving drag position in localstorage issue -

i using grid layout plugin, gridifier , has dragging , re-ordering function. order of items set using attribute data-gridifier-item-id i have set code original order data-gridifier-item-id , new order data-gridifier-item-id , save localstorage. can see in console both of these changing drag items new positions not sorted based on localstorage when reload page. i novice , not able see missing in getting happen. or direction appreciated. here example codepen //gridifier code var grid = $(".gallery"); var settings = { "class": "item", grid: "vertical", // default = "vertical" dragifier: true, // default = false dragifiermode: "intersection" } var asyncgrid = new gridifier(grid, settings ); asyncgrid.append(asyncgrid.collectnew()); //localstorage code $( function() { var gridifier = asyncgrid.collectnew(); var newsortorder = []; // global variable saving order, used later var storedsortorde

loops - Counting and printing a serial number +1 if less than last serial number JavaScript -

so have 2 serial numbers , 199 serials in between them: 899720101000105500 (first) 899720101000105699 (last) i need print first serial , 199 last serial. thing i've found +1 first serial every time loop runs , printing it. i've copied/pasted different parts , have: var lowend = 899720101000105500; var highend = 899720101000105699; var arr = []; while(lowend <= highend){ arr.push(lowend++); } is there max number length can store in variable? here's solution specific problem may come across this. make static parts of number (the digits don't change) string , use digits change (for me last 4) count , add string count , log it. var serialnumber = 5500; while(serialnumber <= 5699) { serialnumber = serialnumber + 1; var fullnumber = "89972010100010" + serialnumber; console.log(fullnumber); }

c# - Changing Opacity With Reactive Extensions -

<rant>yes, know easier implement in wpf. hear lot. sadly, not possible. </rant> i writing winforms app, , need "fade" control in & out. transparency impossible in winforms, trying use opacity: idea change alpha channel of each child control's forecolor property on period of time. seems perfect time work on reactive extensions! my possible solution is: private void fadeout() { // our list of values alpha channel (255 0) var range = enumerable.range(0,256).reverse().tolist(); // how long between each setting of alpha (huge value example only) var delay = timespan.fromseconds(0.5); // our "trigger" sequence, every half second observable.interval(delay) // paired values range - keep range .zip(range, (lhs, rhs) => rhs) // make onnext changes on ui thread .observeon(synchronizationcontext.current) // every time value rec'd sequence .subscribe(