Posts

Showing posts from March, 2011

matlab - Create vector of dates by start date and end date -

is possible create vector automatically or progressively dates. want ask user starting date , final date , i'd fill vector dates , ones between both. so abstractly: "what first date?" '...' firstdate = '...' --> "what final date?" '...' finaldate='...' and following, i'd fill in vector of dates between firstdate , finaldate. possible in matlab, , how? there function use? you can use linspace after user input: %// prompt , user input prompt1 = 'what first date? (yyyy-mm-dd)\n'; prompt2 = 'what last date? (yyyy-mm-dd)\n'; startdate = datenum(input(prompt1,'s'),'yyyy-mm-dd') enddate = datenum(input(prompt2,'s'),'yyyy-mm-dd') % number of days numdays = enddate-startdate % array of dates alldays = linspace(startdate,enddate,numdays) datestring = datestr(alldays, 'mm/dd/yyyy') for input 1989-07-01 , 1989-07-07 return: datestring = 07/01/198

c++ - Reading a file using fstream -

when try read file buffer, appends random characters end of buffer. char* thefile; std::streampos size; std::fstream file(_file, std::ios::in | std::ios::ate); if (file.is_open()) { size = file.tellg(); std::cout << "size: " << size; thefile = new char[size]{0}; file.seekg(0, std::ios::beg); file.read(thefile, size); std::cout << thefile; } int x = 0; while original text in file is: "hello" output becomes: "helloýýýý««««««««Ã¾Ã®Ã¾Ã®Ã¾" could me happening here? thanks if file not opened ios::binary mode, cannot assume position returned tellg() give number of chars read. text mode operation may perform transformations on flow (f.ex: on windows, convert "\r\n" in file in "\n", might find out size of 2 read 1) anyway, read() doesn't add null terminator. finally, must allocate 1 more character size expect due null terminato

javascript - server.address().address is not set when https.createServer() in node -

simple this: server.address().address blank. why this? can set it? server = https.createserver(options, app).listen(port, function () { console.log('listening on https://' + server.address().address + ':' + server.address().port); }); which returns listening on https://:::9804 server.address() returns { address: '::', family: 'ipv6', port: 9804 }

magento - Rename "example" directory in solr -

i have installed apache-solr-3.5.0 magento enterprise site. have run solr using /etc/solr/apache-solr-3.5.0/example$ sudo java -jar start.jar , working. live site have rename "example" folder name "project1" , tried with /etc/solr/apache-solr-3.5.0/project1$ sudo java -jar start.jar couldn't access solar admin. the execution stops at 2015-08-19 17:30:16.578:warn::failed socketconnector@0.0.0.0:8983: java.net.bindexception: address in use 2015-08-19 17:30:16.579:warn::failed server@309db6ff: java.net.bindexception: address in use 2015-08-19 17:30:16.579:warn::exception java.net.bindexception: address in use @ java.net.plainsocketimpl.socketbind(native method) @ java.net.abstractplainsocketimpl.bind(abstractplainsocketimpl.java:376) @ java.net.serversocket.bind(serversocket.java:376) @ java.net.serversocket.<init>(serversocket.java:237) @ java.net.serversocket.<init>(serversocket.java:181) @ org.mortbay.jetty.bi

asp.net mvc 4 - how to insert data in multiple tables at same time in mvc 4 razor using entity framework -

my controller public actionresult create(product collection1, coin_bar collection2, jewellery collection3, gift collection4, stockdetail collection5, productrating collection6) { //var vm=new viewmodel(); //vm.coin_bars=entity.coin_bar(); //vm. if (modelstate.isvalid) { var result1=entity.products.add(collection1); entity.savechanges(); long productids = result1.productid; collection2.productid = productids; var result2 = entity.coin_bar.add(collection2); entity.savechanges(); collection3.productid = productids; var result3 = entity.jewelleries.add(collection3); entity.savechanges(); collection4.productid = productids; var result4 = entity.gifts.add(collection4); entity.savechanges(); collection5.productid = productids; var result5 = entity.stockdetail

angularjs - ionic locally stored video dont work on android -

i have problem playing videos locally stored inside ionic app. think tried every possible solution without success. decided ask here. try describe how app built. my root folder is: /myapp/www/ in index.html inside body tag have ion-nav-view tag pair. im using 3 templates stored in: /views/homepage.html /views/sights/list.html /views/sights/detail.html inside /js/app.js have controllers each template , until here everthing works fine. inside /views/sights/detail.html im using video tag: <div class="video-container"> <video controls="controls"> <source ng-src="/video/vid01.mp4" type="video/mp4"/> </video> </div> i have set: <ion-content overflow-scroll="true"> <manifest android:hardwareaccelerated="true" ....> inside androidmanifest.xml <uses-permission android:name="android.permission.read_external_storage" /> other src paths tried

hibernate - SQL data accessed concurrently - StaleObjectStateException -

class document{ hasmany{ changes: pendingchange} } class documentservice{ def acceptall(){ def owner = document.get(params.id) def changes = owner.changes.findall{it.status == "pending"}.collect{it.id} executorwrapperservice.processclosure({ changes.each{pc -> //*1 changeservice.accept(pc) } }, owner) redirect(url: request.getheader('referer')) } } class documentcontroller{ def index(){ def result = [:] def owner = document.get(params.id) //even if processing running, want show how many left. accept/reject buttons disabled if processingpc true result.changes = owner.changes.findall{it.status == "pending"} if(executorwrapperservice.hasrunningprocess(owner)){ //*2 result.processingpc = true } . . . return result } } class executorwrapperservice { def executo

batch file - "Directory Name Invalid" error from Customized TFS Build Definition -

Image
i trying run (empty) batch file customized tfs build definition, every time process hits "run script" build activity, "directory name invalid" error . we using tfs 2013 update 4 on windows server 2008 r2 standard, , running visual studio 2013 win 8.1 pro on dev machine. the batch file in question @ "c:\builds\sp_base" on tfs server (as shown in test condition in customized build template. here's template (based on gittemplate.12.xaml, since using git our source control): this definition our "run script" action: from log file, can see test directory batch file passes without issue. same log file shows error: does know how resolve this, please? i've seen other threads discussing "directory name invalid" issue in other contexts, , closest match 1 referring fact cmd.exe gets invoked without sufficient privileges. if looking @ symptom of similar issue here, what should invoke cmd.exe tfs build process without e

Polymer returning JSON object on AJAX success not using jquery -

i'm trying animate svg images based on degree provided user. requirement have read degree external json file. i'm new polymer how can achieved? you can use iron-ajax . here's example: <iron-ajax url="post.json" auto last-response="{{theresponse}}"></iron-ajax> the url attribute here refers url target of request, auto means performs request either when url or params changes, , last-response refers last response object received.

angularjs - Make UI uneditable when we are moving from one page to another -

i trying userlogin through webservice. project using bootstrap css , angular in backend. having login screen hidden div shoown when user click login button.its animated login icon. working fine.i want make background whole page including userid, password uneditable signin button unclickable. when hit login button can make input(s) , button(s) disabled make sure remain unchanged. when result rest call can re-enable them all.

php - Textarea and input text is editable when using HTML2PDF plugin -

i using htl2pdf plugin . my problem texarea , pdf editable in pdf recieve my code follow require_once(app_path().'/libs/html2pdf/html2pdf.class.php'); $html2pdf = new html2pdf('p','a4','en'); $html2pdf->pdf->setdisplaymode('fullpage'); $html2pdf->writehtml($html22); $htmltosend=$html2pdf->output('','s'); is there way can stop converting editable pdf if understand correctly, want create pdf, should not editable? use setprotection like: $html2pdf->pdf->setprotection(array('print'), ''); you can find further information @ http://wiki.spipu.net/doku.php?id=html2pdf:en:v4:protect . if use empty permissions array, viewing not printing allowed. possible values permissions are: copy: copy text , images clipboard print: print document modify: modify (except annotations , forms) annot-forms: add annotations , forms

html - Google Map is not working in my responsive tab -

my google map not working i used tab view http://www.petelove.com/responsivetabs/ my google map init() is: var map; function initmap() { map = new google.maps.map(document.getelementbyid('map'), { center: {lat: <?php echo $lat; ?>, lng: <?php echo $long; ?>}, zoom: 3 }); when run google map in first tab it's working fine. when load in second tab. view only. no map displaying..... this question has been asked thousand times on website. should first search before asking again. the key map hidden when initialized , therefore, need trigger resize event once tab has been shown . google.maps.event.trigger(map, "resize"); regarding "tabs" library: choose library exposes events . doesn't seem case (or not documented) library choose. a quick example: bootstrap tabs this library exposes events: events when showing new tab, events fire in following order: hide.bs.tab

parse.com - Handling huge numbers of Relations in Parse -

im using table viewedposts link users , blogposts. as dont need of data, , experiment on optimisation , bandwidth usage, i'd move relation column. this relation column become large, lets millions of relations. lets want have list of blogs , want know if have been viewed user. i'd need full set of relations paginated blogs, if user has viewed millions of blog posts? i'm pretty sure parse not return millions of relations in user object, truncated. what best solution this? you have answer, think, little restatement: user has relation called viewedblog . gets added-to each time user views blog ("blog post" mean here), can relate zillions of those. that's fine since relation column reference table. when have user, can viewedblog relation, , when relation can it's query . query has features , limitations of regular parse.query (because one). so can set limit 1k, qualify further (say, post tags), sort (say, descending on recency)

plsql - PL/SQL garbage value cleaning -

a table contains millions of records in there 12 critical columns contain garbage values. not records in these 12 columns garbage. there records fine while others garbage. so want write pl/sql script clean these garbage values without using update statement 12 times. have code written doesn't seem work cause. suggestions modify code or change code entirely welcome. suppose dynamic sql used here don't have knowledge of ever , i'm short on time. set serveroutput on declare count_total number := 0; number :=0; ch varchar2(10); ch2 varchar2(10); cursor cursor_sim_b select a1, a2, a3, a4, a5, a6, b1, b2, b3, b4, b5, b6, -- identify trim(translate(a1,'0123456789',' ')) a_1, -- garbage values trim(translate(a2,'0123456789',' ')) a_2, trim(translate(a3,'0123456789',' ')) a_3, trim(translate(a4,'0123456789',' ')) a_4, trim(translate(a5,'0123456789',' '))

cloudfoundry - Communication between instances in Cloud Foundry -

is there possibility communicate between multiple instances of application deployed cloud foundry? checked cloud foundry api couldn't find mention of subject. tried hazelcast unfortunately, cloud foundry provider doesn't support multicasting, have know ip addresses of every other instance in order connect. i think can't 1 interested in this. i recommend use messaging service (like rabbitmq) communicate between instances of applications. can store shared information in database service or remote location outside file system. it not practice build applications require type of communication in cloud. each instance should ideally able run independently , stateless.

javascript - meteor connection to an other mongodb (not the local one) -

i have launched localhost:207017 mongod 3.0.5 separate mongodb meteor's want connect meteor (which has local mongodb). have seen in how use existing mongodb in meteor project? can use: export mongo_url=mongodb://localhost:27017/your_db link "something" mongo server. question: where mongo_url env variable stored ie locally in meteor appli ? meteor appli dealing or meteor. how come local mongodb of appli with following code, no collection created in your_db have new collection (empty) called meteor_accounts_loginserviceconfiguration. in meteor, using todo example meteor doc site .js file tasks = new mongo.collection("tasks"); if (meteor.isclient) { // code runs on client template.body.helpers({ tasks: function () { return tasks.find({}); } }); } .html file <body> <div class="container"> <header> <h1>todo list</h1> </header> <ul> {{#each tasks}

android - WHY? AndroidStudio+Gradle = 46000 method count VS Eclipse+Ant = 43000 method count -

i'm compiling project using proguard google play services 7.5, android 21 , support v4 library. method count higher if compile android studio if compile eclipse. used program called dex-method-count 2 apks generated both programas , discovered reason: androidstudio+gradle: support: 5416 v4: 2755 app: 594 content: 33 graphics: 96 drawable: 96 internal: 74 view: 74 media: 123 session: 60 os: 13 text: 17 util: 166 view: 1024 accessibility: 204 widget: 615 v7: 2661 app: 232 appcompat: 1 internal: 1757 app: 77 text: 3 transition: 1 view: 628 menu: 536 widget: 1047 view: 24 widget: 647 eclipse + ant: support: 2073

c++ - how to show enter password in the form of Asterisks(*) on terminal -

i want write simple c program verify password , example if password equal 1234 want print welcome else try again . problem follows: i want display enter password in form of * ( star ). for example ..if user enter 1234 appear **** avoid other person see entered password. can give me idea how achieve using c or c++. platform : unix the solution platform-specific, unfortunately. on linux or bsd, can use readpassphrase function (there getpass , though suffers not allowing buffer , buffer size provided caller. documentation gnu lib c (link broken? try this alternative instead) library provides excellent guide on how implement in terms of lower level termios primitives, can use on other unix implementations in lieue of getpass). on windows, can use setconsolemode disable default echoing behavior (and echo own characters such asterisk). use setconsolemode restore echoing. i should add, however, poor form of authentication involves yet more passwords bane of ev

javascript - How to take the string value out of its scope(unstring)? -

i have looked through string methods, couldn't find method throw string value out of scope. there function unstring string in javascript? instance if receive calculation in string form file: var 5 = 5 var 3 = 3 var calculation = 5 * three; var string = 'calculation * 1232123 - 5 + three'; how can store received string in variable values out of string scope , calculated? there way or there method so? you can use eval function. remember, eval evil .

How to setup multiples step definitions for Cucumber Java features on Intellij -

i trying create several step definitions classes several features. project structure: . ├── cucumberpoc.iml └── src └── test ├── cucumberrunner.java └── features ├── cheesestepdefinition.java ├── stepdefinition.java ├── cheese.feature └── myfeature.feature it cucumberrunner.java class: package test; import cucumber.api.cucumberoptions; import cucumber.api.junit.cucumber; import org.junit.runner.runwith; @runwith(cucumber.class) @cucumberoptions( format = {" pretty", "json:target/cucumber.js"}, features = { "src/test/" } ) public class cucumberrunner { } there 2 step definitions classes. when run cheese.feature got error: /library/java/javavirtualmachines/jdk1.8.0_60.jdk/contents/home/bin/java ... testing started @ 9:26 ... undefined step: given go google undefined step: when ask cheese undefined step: should see many offers 1 scenario (0 passed) 3

javascript - need help to select month in gmail account with imacros -

to create gmail account imacros have completed getting problem month, have tried lots can not select month imacros. http://i.stack.imgur.com/nbodi.jpg the codes month as: <div class="goog-menu goog-menu-vertical" aria-haspopup="true" role="listbox"> <div id=":1" style="-moz-user-select: none;" role="option" class="goog-menuitem"><div class="goog-menuitem-content">january</div></div> <div id=":2" style="-moz-user-select: none;" role="option" class="goog-menuitem"><div class="goog-menuitem-content">february</div></div> i have tried following code: tag pos=1 type=div form=id:createaccount attr=role:listbox content=#3 tag pos=1 type=div attr=txt:july content=#3 it clicking on month button not selecting month. could me sort out problem? try following code:

android - FATAL EXCEPTION java.lang.NoClassDefFoundError: Failed resolution of: Lorg/apache/http/util/Args -

i sending recorded audio file server using httppost method, receiving following error: fatal exception java.lang.noclassdeffounderror: failed resolution of: lorg/apache/http/util/args here code: file = new file(environment.getexternalstoragedirectory().getabsolutepath()+"/" + "javacodegeeksrecording.3gpp"); string yournodejsbluemixroute = "http://mobilefeedbackform.mybluemix.net"; try { toast.maketext(mainactivity.this, "inside try", toast.length_long) .show(); system.out.println(is); httpclient client = new defaulthttpclient(); httppost post = new httppost(yournodejsbluemixroute); toast.maketext(mainactivity.this, "before sending", toast.length_long) .show(); post.setheader("enctype", "multipart/form-data"); /*filebody bin = new filebody(is);*/ filebody fb = new fi

java - How to @Autowire a SessionFactory to a Servlet? -

i trying @autowire sessionfactory in gwt servlet. tried first loading using application context: this.sessionfactory = (sessionfactory) applicationcontext.getbean("sessionfactory"); but guess doesn't work way if want use @transactional annotation. that's why i'm trying auto wire telling spring sessionfactory property set on setsessionfactory(sessionfactory sessionfactory); not work either somehow: package com.mahlzeit.server.web.repository.impl; // .. @component public class restaurantserviceimpl extends xsrfprotectedserviceservlet implements restaurantservice { public restauranownerrepository restaurantownerrepository; private sessionfactory sessionfactory; @autowired public void setsessionfactory(sessionfactory sessionfactory) { this.sessionfactory = sessionfactory ; } @override public void init(servletconfig config) throws servletexception { super.init(config); @suppresswarnings("res

C++: How can I make an infinite loop stop when pressing any key? -

i'm totally new programming , don't have idea other topics saying this. please explain on c++. you can quit program, there no real way make stop key on basic level. alternatively can use condition loop, e.g. int counter = 0; int countermax = 100; while (true && (counter++ < countermax)) { // code here } if (counter >= countermax) { std::cout << "loop terminated counter" << std::endl; // maybe exit program }

excel vba - VBA Word: conditional text replacement -

i have macro searches replaces series of words in document code: 'define array1 words want replaced 'define array2 words want replace have same index 'loop through array , search , replace application.activedocument.content.find i=1 565 .text=array1(i) .replacement.text=array2(i) .wrap=wdfindcontinue .format=false .matchcase=false .matchwholeword=true .matchwildcards=false .matchallwordsforms=false .matchsoundslike=false .matchsuffix=true .matchprefix=true .execute replace:=wdreplaceall next end i want change functionality won't replace word if first word in line, realize find function doesn't work line line, or allow conditional testing of properties, think best approach me change range function operates on exclude first word in each line. so instead of activedocument.content.find need activedocument.range defined somehow excludes first word of each line. does know how define range excludes first word of each line. thanks not sure of applicat

powershell - Format Log Output -

my script backing multiple sql server databases , have outputting each database , file name log file. unsure how align them in column format. function logwrite { param ([string]$logstring) add-content $logfile -value $logstring } $server = new-object ("microsoft.sqlserver.management.smo.server") "(local)\sqlexpress" $databases = $server.databases $array = @($db1,$db2,$db3,$db4,$db5,$db6,$db7,$db8,$db9,$db10,$db11) foreach ($element in $array) { foreach ($db in $databases) { if($db.name -like $element) { $dbname = $db.name $datetime = get-date -format yyyy_mm_dd $fullbackupfilepath = ($backupdirectory + "\" + $dbname + "_full_" + $datetime + ".bak") backup-sqldatabase -serverinstance $sqlserver -database $dbname -backupfile $fullbackupfilepath logwrite "$dbname - $backupdirectory" } } } this looks like: databases succesfully backed up: aqm c:\mappa

Git for application code (PHP) along with PL/SQL code? -

i'm having doubt time ago, , have end leaving sql scripts outside version control (i try encapsulate code in database as can). but find interesting have version control of both app code , database scripts; having snapshots of database situation (just ddl , stored procedures) in each commit pretty useful. would have app code , sql scripts in different branches (and having cherry-pick, merge, whatever, many times)? do think it's idea? usually, having database-related files e.g. construct database schema or provide migration routines inside application repository fine. after all, application needs database, , repository should provide necessary set up. having scripts there construct database, , import base data required fine. it include scripts provide test data in order run tests (often referred fixtures ). the thing avoid having production data inside repository. else required application run: include in repository.

Update Table only works once in datagridview (c#) -

i have datagridview in have made cells editable. once user has entered text, hit "update" button, updates database. the problem whenever open application, update first time. when try make more modification , click "update" button, fails update database. here code. please suggest solution private void form1_load_1(object sender, eventargs e) { con.open(); sda = new sqldataadapter("select * name", con); ds = new system.data.dataset(); sda.fill(ds); datagridview1.datasource = ds.tables[0]; } private void button1_click(object sender, eventargs e) { scb = new sqlcommandbuilder(sda); sda.update(ds); } actually, there nothing wrong code mentioned. instead there section causing db not updated. i kept refresh button code - private void button2_click(object sender, eventargs e) { sda = new sqldataadapter("select * name", con); datat

windows - CreateProcess hook to add CommandLine -

i have project adding specific flags (command lines) chrome browser, problem doing creating new chrome shortcut, flags want execute. in last days solution became superficial, , requested more 'deeper'. looking on windows registry, didn't found solution always add flags when run chrome, started thinking hook createprocess explorer, , check if process run chrome, add flags in lpcommandline attribute. i know hook explorer pretty 'intrusive' solution, became helpful because have other achieves putting off on project, , hooking me them done. i got hook working, tried many ways add command lines when chrome found, no success... right (and tried @ least 8 different solutions) detour function is: function interceptcreateprocess(lpapplicationname: pchar; lpcommandline: pchar; lpprocessattributes, lpthreadattributes: psecurityattributes; binherithandles: bool; dwcreationflags: dword; lpenvironment: poin

android - Google now handles whatsapp messaging -

i see there many threads on how send whatsapp message without opening whatsapp? all answers lead either of these 2 options: open whatsapp -> select contact. message set in intent sent contact. open whatsapp specific contact -> paste manually message set in intent , hit send. so, there no option provided whatsapp directly send message contact in background. if so, how googlenow able hold of unavailable service of whatsapp? if new service opened in google or whatsapp, can pointers use in app? whatsapp doesn't have information it, , doesn't have api. refer these discussions: whatsapp's philosophy push storage down devices, rather doing central server based message storage. means api needs live on device well. because "whatsapp not want inundate users messages don't want see", per brian acton in latest f8 conference. while may sad developers, think it's decision. whatsapp's appeal private, human, group

javascript - jQuery wait for image to load before looping -

this js , jq code : for (i = 0; < data.length; i++) { var $nitem = $('.search_result_template').clone().removeclass("search_result_template"); src = link_db + data[i]._id + "/" + readconfigurationsettings_img_upload_name()+"0"; $("<img/>") .on('load', function () { alert("image loaded correctly"); alert("src: " + src); $nitem.find('.var_link_img').attr('href', src); }) .on('error', function () { alert("error loading image"); var src = readconfigurationsettings_link_default_img(); $nitem.find('.var_link_img').attr('href', src); }) .attr("src", src); $nitem.find('.var_link_img').text('image'); $nitem.attr("id", "search_result_template_" + i); //alert($nitem.html()); $search_re

selenium - Can any one help me , my Test Ng annotations are not running .In the Below code my @before class only running but not other -

in below code trying automate gmail data driven frame work using testng , code @before annotation executing not other 2 .please healp me. import org.openqa.selenium.by; import org.openqa.selenium.webdriver; import org.openqa.selenium.firefox.firefoxdriver; import org.testng.annotations.test; import org.testng.annotations.beforetest; import org.testng.annotations.aftertest; public class logindata { webdriver driver; @test public void login() { driver.findelement(by.linktext("sign in")).click(); system.out.println("hello"); } @beforetest public void beforetest() throws exception { webdriver driver=new firefoxdriver(); driver.get("https://www.gmail.com/intl/en/mail/help/about.html"); thread.sleep(2000); } @aftertest public void ftertest() { driver.close(); } } since have declared webdriver driver already; remove webdriver webdriver driver==new firefoxdriver(); i tried below , wor

actionscript 3 - AS3 gotoAndStop not working -

i'm having problem app. i've 3 frame in timeline, in 2nd frame i've mc own class: @ end of animation of mc call function main class. the code of mc class this public function frame134() { stop(); var vmaintimeline: maintimeline = new maintimeline(); vmaintimeline.gotoframe3(); } the function in main class this public function gotoframe3() { trace("gotoframe3"); this.gotoandstop(3); trace("done"); } the output in console gotoframe3 , done gotoandstop(3); doesn't work. suggestion or help? in advance rather creating instance of maintimeline need reference using parent property or referring stage directly. replace frame134() method below code. public function frame134() { var stageref = this.parent; stageref.gotoandstop(3); } or with public function frame134() { stage.gotoandstop(3) } hope work you.

linux kernel - add attribute to an existing kobject -

i'm working on porting driver i've written 2.6.x kernel series 3.x (i.e. rh el 6 -> rh el 7). driver solution comes in 2 modules: modified form of ahci.c (from kernel tree) , own upper-layer character driver access ahci registers , executing commands against drive. in porting centos 7, i've run interesting problem. changes drivers i'm building on remove access scsi_host attributes in sysfs. question is, can append attributes onto devices existing in sysfs? every example i've come across shows making attributes @ point of device creation, e.g.: static ssize_t port_show(struct kobject *kobj, struct kobj_attribute *attr, char *buff); static struct kobj_attribute pxclb_attr = __attr(pxclb, 0664, port_show, null); static struct attribute *attrs[] = { &pxclb_attr.attr, null, }; static struct attribute_group port_group = { .attrs = attrs, }; /* other code */ sysfs_create_group(&kobj, &port_group); this ex

asp.net - Web API - Handling HEAD requests and specify custom Content-Length -

i haven api-controller serving files via get-requests. i'm using pushstreamcontentresponse , works well. i can set content-length-header on response object. now want support head-requests. i've tried http://www.strathweb.com/2013/03/adding-http-head-support-to-asp-net-web-api/ , while may work, need solution don't need process request: retrieving file , streaming expensive, getting meta data (length, etc) practically no-op. however, when try set content-length header, overwritten 0. i have added request tracing , see message returned handler displayed correct url, content-disposition , content-length. i have tried using custom httpresponse , implement trycomputelength. , while method indeed called, result discarded @ point in pipeline. is there way support using web api? in end, simple. create handler head request return body @ least 1 byte content, set content-length-header of response desired length. using body 0 length won't work. this

ms access - Only show data from chosen option from previous column in a lookup field -

i have 3 tables - simplicity let's call them - meat, dish, , order. in meat table, there different types of meat; in dish table, there different types of dishes can prepare types of meats; in orders table, orders these dishes shown. orders table has orderid, meatid, dishid. i'm trying make in design view on microsoft access when drop menu displays types of meat in meatid column , chooses one, other drop down menu in dishid column display types of dishes in relation meat if so, there way make access automatically know using code: select meat.meatname, dish.dishname dish inner join meat on meat.meatid = dish.meatid meatid = [the selected meat in previous column] you can use meat combobox value criterium, this: where meatid = forms!yourformname!cbomeat additionally, in afterupdate event of cbomeat need: me.cbodish.requery so read dishes newly selected meat. for more examples, search for: access linked combo boxes it's common (and useful) tech

machine learning - Adding one more feature to my feature set which has no effect in calculation and act as a distiguishable feature -

i have of problem follow: i have 10000 thousand of tweets , and have features labeled 1 or 2 . wanna add feature problem here: i want give each tweet (a feature)a unique id according user posted tweet, if user posted 3 posts these 3 posts same id since same user posted them way can more sure in classifying these tweets in same group since can claim if of these tweets assigned same label newly coming tweet more probable in same group.also using decision tree , naive bayes question make sense since feature not numeric , has no effect in calculation , acts dummy feature used distinguishing tweets?

javascript - Netscape 7.0+ set HTML DOM node text (ECMAScript 3) -

i trying set inner text of element on netscape 7.0 have tried var element = document.getelementbyid('element'); element.textcontent = 'working1'; element.innertext = 'working2'; this works in current browsers ie8+, ff, chrome, opera, microsoft edge, safari history from: https://www.w3.org/community/webed/wiki/a_short_history_of_javascript the standards process continued in cycles, releases of ecmascript 2 in 1998 , ecmascript 3 in 1999, baseline modern day javascript. "js2" or "original es4" work led waldemar horwat (then of netscape, @ google) started in 2000 , @ first, microsoft seemed participate , implemented of proposals in jscript.net language. according to: https://en.wikipedia.org/wiki/netscape_(web_browser) netscape 7.0 released on august 29, 2002 according to: https://en.wikipedia.org/wiki/ecmascript ecmascript 3 released on december 1999 ecmascript 3 specification .innertext

linux - Use of & in shell Scripting and Process Creation in Unix -

the following code main(int argc, char **argv){ char *myname=argv[1]; int cpid=fork(); if(cpid==0){ printf("the child %s of %d\n",myname,getpid()); exit(0); } else{ printf("my child %d\n",cpid); exit(0); } } now writing shell script run it.the following shell script #!/bin/sh clear gcc arg.c for((i=1;i<=5;i++)) ./a.out invocation$i done the output is my child 28629 child 28631 child invocation1 of 28629 child 28633 child invocation2 of 28631 child 28635 child invocation3 of 28633 child 28637 child invocation4 of 28635 child invocation5 of 28637 however if put & after invocation$i in script output is my child 29158 child 29159 child 29160 child 29161 child invocation4 of 29159 child invocation5 of 29158 child invocation3 of 29160 child invocation2 of 29161 child 29163 child invocation1 of 29163 can please explain difference between 2 outputs , use of &. , should don

html - paragraph tag not closed? -

Image
i simplified html code down this <!doctype html> <body> <div class="index-div"> <p id="whoarewe"> <h2>who we?</h2> wersfgse </p> </div> </body> </html> however, when run , open page source, says "no p element in scope p end tag seen". runs fine strange reason, intellij idea , firefox both show unnecessary /p tag. computer glitching out? edit: chrome says it's ok there's fixed set of elements, belonging phrasing content category, can children of <p> element: phrasing content text of document, elements mark text @ intra-paragraph level. runs of phrasing content form paragraphs. a abbr area (if descendant of map element) audio b bdi bdo br button canvas cite code data datalist del dfn em embed iframe img input ins kbd keygen label map mark math meter noscript object output progress q ruby s samp script select small span strong su

php - cURL - not properly working with JSON requests or Not saving Session -

everyone! i have 2 controllers meant search on websites. can search on them if logged in. so.. tracking post request , data goes file give answer , login page redirects normal logged in page. first controller code $ch = curl_init(); curl_setopt($ch, curlopt_url, self::loginurl); #curl_setopt($ch,curlopt_httpheader,$httpheader); curl_setopt($ch, curlopt_cookie, $cookie); curl_setopt($ch, curlopt_post, true); curl_setopt($ch, curlopt_postfields, $postdata); curl_setopt($ch, curlopt_cookiesession, true); curl_setopt($ch, curlopt_returntransfer, false); curl_setopt($ch, curlopt_followlocation, true); curl_exec($ch); so, goes loginurl, post data , displays 1, instead of website(with me logged in). 1 answer json file give successful login. problem not logged in, if set new curl handler home url. same problem goes second controller, code: $ch = curl_init(self::loginurl); curl_setopt($ch, curlopt

ios - imagePickerController error selecting a Photo -

i'm using imagepickercontroller, when select imagen got error: fatal error: unexpectedly found nil while unwrapping optional value i dont know why because im unwrapping value if let func imagepickercontroller(picker: uiimagepickercontroller, didfinishpickingmediawithinfo info: [nsobject : anyobject]) { if let img = info[uiimagepickercontrolleroriginalimage] as? uiimage { photoimageview.image = img } dismissviewcontrolleranimated(true, completion: nil) } does error occurs @ line photoimageview.image = img in case might photoimageview nil (it implicitly unwrapped optional). updated comments: please check photoimageview @iboutlet , connected uiimageview on storyboard. if creating programmatically, try adding view in window before setting image.

stata - How to collapse numbers with same identifier but different date, but preserve the date of first observation for each identifier -

i have dataset can simplified in following format: clear input str9 date id vara varb "12jan2010" 5 21 42 "12jan2010" 6 47 21 "15jan2010" 10 7 68 "17jan2010" 6 -5 -3 "19jan2010" 6 -1 -1 end in dataset, there date, id, vara, , varb. each id represents unique set of transactions. want collapse (sum) vara varb, by(date) in stata. however, want keep date of first observation each id number. essentially, want above dataset become following: +--------------------------------+ | date id var1 var2 | |--------------------------------| | 12jan2010 5 21 42 | | 12jan2010 6 41 17 | | 15jan2010 10 7 68 | +--------------------------------+ 12jan2010 17jan2010 , 19jan2010 have same id, want collapse (sum) var1 var2 these 3 observations. want keep date 12jan2010 because date first observation. other 2 observations dropped. i know might possible collapse id first , merge original datas

Receiving empty data from Kafka - Spark Streaming [SOLVED] -

why getting empty data messages when read topic kafka? problem decoder? *there no error or exception. thank you. code: def main(args: array[string]) { val sparkconf = new sparkconf().setappname("queue status") val ssc = new streamingcontext(sparkconf, seconds(1)) ssc.checkpoint("/tmp/") val kafkaconfig = map("zookeeper.connect" -> "ip.internal:2181", "group.id" -> "queue-status") val kafkatopics = map("queue_status" -> 1) val kafkastream = kafkautils.createstream[string, queuestatusmessage, stringdecoder, queuestatusmessagekafkadeserializer]( ssc, kafkaconfig, kafkatopics, storagelevel.memory_and_disk) kafkastream.window(minutes(1),seconds(10)).print() ssc.start() ssc.awaittermination() } the kafka decoder: class queuestatusmessagekafkadeserializer(props: verifiableproperties = null) extends decoder[queuestatusmessage] { override def frombytes(bytes: array[byte]): queuestat

java - JAX-RS response.getEntity returns null after post -

when invoke next code: response response = target.request(mediatype.application_json_type) .post(entity.entity(form, mediatype.application_form_urlencoded_type)); response.getentity(); response.getentity() null. but when invoke: jsonobject json = target.request(mediatype.application_json_type) .post(entity.entity(form, mediatype.application_form_urlencoded_type), jsonobject.class); variable json not null. i need use first variant because need check response status. why first code not working?and how can status code then? you need use response.readentity(your.class) return instance of type want. example string rawjson = response.readentity(string.class); // or jsonobject jsonobject = response.readentity(jsonobject.class); note there needs provider handle reading java type , application/json. if using jersey , json-p api, see this . general information providers, see this

wordpress - get the menu items for Woocommerce -

i used following code product categories woocommerce. <?php $args = array( 'post_type' => 'product', 'posts_per_page' => -1, 'product_cat' => 'blazzers , hoodies & pullovers, jackets', 'orderby' => 'asc' ); $loop = new wp_query( $args ); while ( $loop->have_posts() ) : $loop->the_post(); global $product; ?> i want product categories menu "tops". in code above try add inside array: 'menu' => 'tops', but didnt have results. feedback? thanks in advanced.

node.js - Unable to install Angularjs on Windows 7 -

while installing angularjs on windows 7. fails below message: c:\angular.js>npm install npm err! git rev-list -n1 ced17cbe52c1412b2ada53160432a5b681f37cd7: fatal: bad o bject ced17cbe52c1412b2ada53160432a5b681f37cd7 npm err! git rev-list -n1 ced17cbe52c1412b2ada53160432a5b681f37cd7: npm err! windows_nt 6.1.7601 npm err! argv "c:\\nodejs\\\\node.exe" "c:\\nodejs\\node_modules\\npm\\bin\\npm- cli.js" "install" npm err! node v0.12.7 npm err! npm v2.11.3 npm err! code 128 npm err! command failed: git -c core.longpaths=true rev-list -n1 ced17cbe52c1412 b2ada53160432a5b681f37cd7 npm err! fatal: bad object ced17cbe52c1412b2ada53160432a5b681f37cd7 npm err! npm err! npm err! if need help, may report error at: npm err! <https://github.com/npm/npm/issues> npm err! please include following file support request: npm err! c:\angular.js\npm-debug.log what reason fatal bad object? if installing angular npm inside console window in ide

ruby on rails - exists? returns true in the console, but not in my controller -

i'm trying have create action finds lesson date , school_id. if no lesson exists parameters, create new lesson. reason i'm not using find_by_or_create, or similar method, because want add goals of lesson if exists, nor overwrite it. here's controller, believe that's that's relevant: the exists? call never returning true, though when run rails console , type console same parameters, returns true. same find_by def create find_or_create_lesson if @lesson.save flash[:success] = "response logged" redirect_to @lesson else @user = current_user @school_options = school.all.map { |s| [s.name, s.id] } render 'new' end end private # strong params def lesson_params params.require(:lesson).permit(:school_id, :date, goals_attributes: [:id, :user_id, :text, :lesson_id]) end # finds lesson same date , school, or creates le

c++ - In which cases is it unsafe to (const) reference a return value? -

i tend use following notation lot: const datum& d = a.calc(); // continue use d this works when result of calc on stack, see http://herbsutter.com/2008/01/01/gotw-88-a-candidate-for-the-most-important-const/ . though compilers optimize here, feels nice explicitly avoid temporary objects. today realized, content of d became invalid after data written member of a . in particular case function returned reference member, unrelated write however. this: const datum& d = a.get(); // ... operation ... a.somedata = datum2(); // d invalid. again, somedata has nothing d or get() here. now ask myself: which side-effects lead invalidation? is bad-practice assign return values const reference? (especially when don't know interior of function) my application single-threaded except qt gui-thread. which side-effects lead invalidation? holding reference internal state of class (i.e., versus extending lifetime of temporary) , calling non-const member f