Posts

Showing posts from June, 2015

regex - Yii url rule with regular expression -

i have rule: 'employee/renewoffer/<id_offer:\d+>;<title:.+>' => 'company/renewoffer', http://www.example.com/123;title-of-post which concerns single offer , works great, how rule should if if select multiple offers. link (comma separated id's): http://www.example.com/123,456,12,5;title-of-post as recommended ndn, can allow commas replacing \d+ in rule [\d,]+ . in other words, change rule this: 'employee/renewoffer/<id_offer:[\d,]+>;<title:.+>' => 'company/renewoffer', the square brackets create character class (any of characters listed inside brackets allowed). so, putting \d , , in character class, allows digit or comma match. however, solution allows digits , commas. if want more flexible, change accept character using . . instance: 'employee/renewoffer/<id_offer:.+?>;<title:.+>' => 'company/renewoffer', the ? after .+ makes + non-greedy. means c

Java Date Conversion from Millisecond time -

i trying calculate offset time given date. date string , parse it, , have offset in milliseconds. example date: 2015-08-18 00:00:00 offset time: 2678400000, when applied date, equals 2015-09-18 00:00:00, 31 days later. my goal store each of offsets (years/months/days/hours/minutes/seconds) in array, can use later. when run calculation using calendar class, i'm getting hours reason when called offsetconverter(2678400000) output: 0 years 0 months 31 days 19 hours 0 minutes 0 seconds here code found , modified link best way convert milliseconds number of years, months , days public static int[] offsetconverter(long offset) { int[] delay = new int[6]; //delay 0-3 = years/months/days/seconds calendar c = calendar.getinstance(); c.settimeinmillis(offset); delay[0] = c.get(calendar.year) - 1970; delay[1] = c.get(calendar.month); delay[2] = c.get(calendar.day_of_month); delay[3] = c.get(calendar.hour_of_day); delay[4] = c.get(cale

vba - creating a loop around my select Case -

at present, have functioning select case states if textbox blank highlighted red, seems highlighting 1 of textboxes. instance, if 2 textboxes left blank, highlights first on comes across. select case true case me.custname = "" me.custname.backcolor = &h8080ff case me.regaddress = "" me.regaddress.backcolor = &h8080ff case me.postinput = "" me.postinput.backcolor = &h8080ff case me.landline = "" me.landline.backcolor = &h8080ff case me.contact = "" me.contact.backcolor = &h8080ff case me.dobinput = "" me.dobinput.backcolor = &h8080ff end select being new vba, thinking create loop round current code state (loop until x,y or z <> "") can't seem figure out how this. any advice appreciated. select case runs code block following first matching case statement only. if need check each of conditions regardless, should writ

Buttonclick is not working VB.NET -

can me this, code doesn't have error when click button go previous group box doesn't work :( idk why can me guys figure out? the app has login form when login directs form can choose categories if select category example chose gadgets redirects me gadgets groupbox if try go doesn't go in categories page the button2.click, button6.click , button3.click buttons here's code public class form3 private sub picturebox2_click(sender object, e eventargs) handles picturebox2.click groupbox2.show() end sub private sub button1_click(sender object, e eventargs) handles button1.click dim sbutton dialogresult sbutton = messagebox.show("do want logout now?", "logging out", messageboxbuttons.yesno, messageboxicon.question) if sbutton = dialogresult.yes form1.show() me.hide() end if end sub private sub button2_click(sender object, e eventargs) handles button2.click groupbox1.show() end sub private sub linklabel1

ios - How to connect to a server with iPhone (without Browser) -

i want communicate between arduino , iphone. idea arduino hosts small server accessible local network , iphone gives information connecting , doing specific http request (i hope thats called, please don't bite if isn't). example: 124.566.123(someip)/p1 (the request information). "p1" maybe set pin 1 high. whole process should invisible user, meaning no browser should opened or so. there way (using objective-c)? there number of ways this! when "http get" - referring communicating server on port 80. so, there multiple ways "http get" request iphone - best way to use curl - this question should on right track. all-in-all --- arduinos not best chips web-serving - - - while possible, server-side rendering , whatnot limited - if serious kind of project, recommend upgrading pi or beagle bone black - - not serve more effectively, allow more flexibility - good luck!

Manually controlling memory allocation in C# -

i know if possible explicitly declare memory type (physical or virtual memory) should used c# application performing different actions? let me explain example: lets say, have file of 100 or 200 mb in size. need parse file, access , analyze contents , perform operations on file contents. possible me store entire file , contents of on virtual memory instead of physical memory? if possible, there side-effects/precautions 1 should keep in mind? the reason behind question have deal such huge files or datasets (retrieved databases) , perform operations on them, part of need not occur sequentially or synchronized. want improve execution time , performance of application parallelizing non sequential parts, if possible. generally don't (and shouldn't need to) have insight how physical memory managed. in windows , hence in clr virtual memory. unless have specific problem should pretend physical memory. you can depend on operating system intelligently determine shou

pandas - Create advanced frequency table with Python -

i trying make frequency table based on dataframe pandas , python. in fact it's same a previous question of mine used r . let's have dataframe in pandas looks (in fact dataframe larger, illustrative purposes limited rows): node | precedingword ------------------------- a-bom de a-bom die a-bom de a-bom een a-bom n a-bom de acroniem het acroniem t acroniem het acroniem n acroniem een act de act het act die act dat act t act n i'd use these values make count of precedingwords per node, subcategories. instance: 1 column add values titled neuter , non-neuter , last 1 rest . neuter contain values precedingword 1 of these values: t , het , dat . non-neuter contain de , die, , rest contain doesn't belong neuter or non-neuter . (it nice if dynamic, in other words rest uses sort of reversed variable used neuter , non-neuter. or subtracts values in neuter , no

jquery - how to show a movie after another was finished -

i have 3 short movies , want display them 1 after unit. how can considering lenght of each 1 (about 4,5 sec) $(".1a").hide(); $(".1b").hide(); $(".2a").hide(); var showmovie = function(){ $(".1a").show(function (){ $(".1b").show(); }); } showmovie(); i've answered in relation audio - similar. here's link: https://stackoverflow.com/a/31116896/1173155 the above loops audio using 2 different audio elements. can achieve desired result playing next in loop (eg. pass count value on next iteration can used within selector).

ios - How do I display an arrow for MKPinAnnotationView.rightCalloutAccessoryView, like in Apple Maps? -

Image
do initialize button image similar or there default values can use? mkpinannotationview *newannotation = [[mkpinannotationview alloc] initwithannotation:annotation reuseidentifier:@"pinlocation"]; newannotation.animatesdrop = yes; newannotation.canshowcallout = yes; newannotation.rightcalloutaccessoryview = [uibutton buttonwithtype:uibuttontypedetaildisclosure]; you can show disclosure button following code: - (mkannotationview *) mapview:(mkmapview *)mapview viewforannotation:(id <mkannotation>) annotation { mkpinannotationview *newannotation = [[mkpinannotationview alloc] initwithannotation:annotation reuseidentifier:@"pinlocation"]; newannotation.canshowcallout = yes; newannotation.rightcalloutaccessoryview = [uibutton buttonwithtype:uibuttontypedetaildisclosure]; //for custom button uiimage *btnimage = [uiimage imagenamed:@"arrow.png"]; uibutton *btn = [uibutton buttonwithtype:uibuttontypecustom]; [btn se

c# - Read HttpResponseMessage with WebBrowser object returned from Web API method -

i have requirement wherein need post data web api method webbrowser object in class library. able post data , process same. web api returns httpresponsemessage need read webbrowser object. example: post data: this.navigate(url, "", postdata, additionalheaders); web api returns: return request.createresponse(httpstatuscode.created, "<guid>"); now, want status , read guid webbrowser object. (like read documenttext in ondocumentcompleted event). or need make changes in web api method read guid? whoa !!! need add: response.content.headers.contenttype = new mediatypeheadervalue("text/html");

java - Where the "Hello" will store in String Constant Pool or Heap? -

this question has answer here: when should use intern method of string on string literals 13 answers we know string literals in java programs, such "abc", implemented instances of string class , goes string constant pool. question : "hello" literal store in below case? string str=new string("hello"); if literal goes "string constant pool" intern method do? string literals in code go directly sring pool. calling intern() on them nothing. intern() make sense in cases dinamically constructing strings (in runtime, not compile-time). in cases calling intern() instruct jvm move variable string pool future usage.

proxy - execute bash on Network Location profile change -

i have macbook use work both @ office , @ home. due enterprise's policies, have navigate through proxy. i created 2 newtwork profiles (home, office) in set proxy , credentials have use. however, there several applications have manually edit configuration in order have them work proxy (git, npm, , bunch of others). i created 2 bash files set/unset config key @ convenience . question is: can "listen" event such network profile change, in order run appropriate bash script, depending on selected location? maybe automator can help?

shell - Repeatly replace a delimiter at a given count (4), with another character -

given line: 12,34,56,47,56,34,56,78,90,12,12,34,45 if count of commas(,) greater four, replace 4th comma(,) || . if count lesser or equal 4 no need replace comma(,). i able find count following awk : awk -f\, '{print nf-1}' text.txt then used if condition check if result greater 4. unable replace 4th comma || find count of delimiter in line , replace particular position character. update: i want replace comma || symbol after every 4th occurrence of comma. sorry confusion. expected output: 12,34,56,47||56,34,56,78||90,12,12,34||45 using awk can do: s='12,34,56,47,56,34,56,78,90,12,12,34,45' awk -f, '{for (i=1; i<nf; i++) printf "%s%s", $i, (i%4?fs:"||"); print $i}' <<< "$s" 12,34,56,47||56,34,56,78||90,12,12,34||45

wtforms - How to show field label in error message Python WTF -

wtf form : class replyform(baseform): max_reply_count = integerfield(label=_("max reply count") ,default="10",validators = [v.numberrange(max=10), v.inputrequired(message=_('max reply count required'))]) sleep = integerfield(_("sleep") ,validators = [v.numberrange(min=60), v.inputrequired(message=_('sleep required'))]) wtf generate errors that ["not valid integer value", "number must @ 10."] is possible generating error messages default this? ["max reply count not valid integer value", "max reply count must @ 10."] i dont want define messages pass params v.numberrange(max=10,message=_("max reply count must @ 10.")) i found solution : class baseform(form): def __init__(self, *args, **kwargs): super(baseform, self).__init__(*args, **kwargs) def allerrors(self): allerrors = list() fieldname,errors in self.errors.iterit

java - OutOfMemory with JMH and Mode.AverageTime -

i writing micro-benchmark compare string concatenation using + operator vs stringbuilder . aim, created jmh benchmark class based on openjdk example uses batchsize parameter : @state(scope.thread) @benchmarkmode(mode.averagetime) @measurement(batchsize = 10000, iterations = 10) @warmup(batchsize = 10000, iterations = 10) @fork(1) public class stringconcatenationbenchmark { private string string; private stringbuilder stringbuilder; @setup(level.iteration) public void setup() { string = ""; stringbuilder = new stringbuilder(); } @benchmark public void stringconcatenation() { string += "some more data"; } @benchmark public void stringbuilderconcatenation() { stringbuilder.append("some more data"); } } when run benchmark following error stringbuilderconcatenation method: java.lang.outofmemoryerror: java heap space @ java.util.arrays.copyof(arrays.java:3332)

javascript - Parse URL which contain string of two URL -

i've node app , im getting in header following url , need parse it , change content of 3000 4000 ,how can since im getting "two" urls in req.headers.location " http://to-d6faorp:51001/oauth/auth?response_type=code&redirect_uri=http%3af%2fmo-d6fa3.ao.tzp.corp%3a3000%2flogin%2fcallback&client_id=x2.node " the issue cannot use replace since value can changed (dynmaic value ,now 3000 later can value...) if part of url need change going parameter of redirect_uri need find index of second %3a comes after it. javascript indexof has second parameter 'start position', can first indexof 'redirect_uri=' string, , pass position in next call indexof first '%3a' , pass result next call %3a comes before '3000'. once have positions of tokens looking should able build new string using substrings... first substring end of second %3a , second substring index of %2f comes after it. basically, building string cutting stri

javascript - Filterable row is not working in Asp.net but it is working in MVC -

in below code getting columnheaders not getting auto text boxes filter data below on every column, attribute called in kendo grid filterable:{ mode: "row"}, have added attribute in below result not yet come. same code ran in mvc working fine please me. grid = $("#gridallpayers").data("kendogrid"); var gridheight = $(window).height() - 220; var configuration = { columns: getheaderswithcolumns(), resizable: true, columnmenu: true, reorderable: true, height: gridheight, filterable: { mode: "row" }, navigatable: true, sortable: true, pageable: { input: true, numeric: true } }; var feedback = $("#gridallpayers").kendogrid(configuration).data("kendogrid"); } function getheaderswithcolumns() { var cols = new array(); cols.push( { field: "paye

Same Result is getting override When executing multiple requests using Parallel.Foreach -

problem: same result getting override when executing multiple requests using parallel.foreach i continuously accepting requests , launching new task each request using task factory , using parallel.foreach() execute these requests on multiple processor (as per code's logic) --first launching each request using task.factory task.factory.startnew(() => processprocessorsinparallel(e.configkey, content)); --second execution begin here ,each request getting executed using parallel.foreach , here p.result getting override multile requests ,getting same result(p.result) incorrect. private void processprocessorsinparallel(string configkey, string content) { var processes = getflprocessor().processors.where(p => p.enabled).tolist(); parallel.foreach(processes, (p) => { p.process(content, configkey); var p1 = new pb(); var result = checkresponse.parsefrom(base64.decodebase64(p.result)); }

SQL (Oracle) to query for record with max date, only if the end_dt has a value -

Image
i trying select record row looking @ both start date , end date. need pick max start date, return result max date if end date has value. i hope images below clarify bit more. in oracle based sql. example #2 i can, far, either return records or incorrectly return record in scenario #2 i've yet figure out best way make work. greatly appreciate assistance. thank you! i use analytic function: with sample_data (select 1 id, 1 grp_id, to_date('01/01/2015', 'dd/mm/yyyy') st_dt, to_date('23/01/2015', 'dd/mm/yyyy') ed_dt dual union select 2 id, 1 grp_id, to_date('24/02/2015', 'dd/mm/yyyy') st_dt, to_date('15/02/2015', 'dd/mm/yyyy') ed_dt dual union select 3 id, 1 grp_id, to_date('17/03/2015', 'dd/mm/yyyy') st_dt, to_date('30/03/2015', 'dd/mm/yyyy') ed_dt dual union select 4 id, 2 grp_id, to_date('01/01/

ios - Redirect URL from NSURLConnection -

i trying solve following problem: sending post request additional header values specific url. purpose use nsmutabeurlrequest. works nice when nslog response, need url of redirect. if use request.url in competitionhandler returns url sent post request to, it's not need. any tips on how url of redirect? (it nice if won't change code significantly. below have far: url = [nsurl urlwithstring:@"https://***"]; nsmutableurlrequest *request = [nsmutableurlrequest requestwithurl:url]; [request sethttpmethod:@"post"]; [request setvalue:@"application/json; charset=utf-8" forhttpheaderfield:@"content-type"]; //some additional values set here [request sethttpbody:data]; nsoperationqueue *queue = [[nsoperationqueue alloc] init]; [nsurlconnection sendasynchronousrequest:request queue:queue completionhandler:^(nsurlresponse *response, nsdata *data, nserror *error) { nslog(@"%@", response); if (error) nslog(@"

java - How to update .class file into existing .jar file? -

have 1 ".class" file , want update(add) new changes existing ".jar" file. how in "cmd" prompt(windows os) , steps should follow steps? i assume jar file must quite large , hence trying avoid recreating via ant/maven. if using java 7, visit link : zip file system provider , which treats zip or jar file file system , allows update jar, though it's not via command line.

php - Redirect a site to a Mobile version, error with Google Mobile-Friendly Test -

Image
i have following urls : domain.fr (desktop site) domain.fr/m/ (mobile site) both urls "point" each other using"canonical" or "alternate". we can access urls without problem. i redirect people on mobile : domain.fr/m/ in php, tried : $useragent=$_server['http_user_agent']; if(preg_match('/(android|bb\d+).+mobile|....',substr($useragent,0,4))){header('location: http://domain.fr/m/');} problem : when check domain.fr google mobile-friendly test, error message : (it's google can't check if mobile friendly) if remove php above, google can test says domain.fr not user-friendly. how make redirection mobile site, think it's problem php code, idea ? i think have bug in code, try analyze logs of web server. i have test @ google mobile-friendly test , in google page speed, works fine. nginx logs: 127.0.0.1 - - [22/aug/2015:16:29:16 +0300] "get /test.mobile.php http/1.1" 301 1

c# - Insert new/Update existing record with one to many relationship -

i have 2 simple models creating database tables of entity framework: public class blog { public int id { get; set; } public string title { get; set; } public virtual icollection<post> posts { get; set; } public blog() { posts = new collection<post>(); } } public class post { public int id { get; set; } public string title { get; set; } public string content { get; set; } // foreign key of blog table public int blogid { get; set; } } now in db context have dbset generate database tables: public dbset<blog> blogs { get; set; } database tables generated expected, question, how insert new blog posts db. i've tried this: blog blog = context.blogs.firstordefault(b => b.title == blogtitle); // no blog title yet, create new 1 if (blog == null) { blog = new blog(); blog.title = blogtitle; post p = new post(); p.title = posttitle; p.content = "some content";

c - Why assignment to a subscripted array works and assignment to a dereferenced pointer arithmetic expression - doesn't? -

kernighan & ritchie 2nd ed. says: the correspondence between indexing , pointer arithmetic close. definition, value of variable or expression of type array address of element 0 of array. after assignment pa = &a[0]; pa , a have identical values. since name of array synonym location of initial element, assignment pa=&a[0] can written as pa = a; rather more surprising, @ least @ first sight, fact reference a[i] can written *(a+i). in evaluating a[i] , c converts a[i] immediately; 2 forms equivalent. applying operator & both parts of equivalence, follows and identical: a+i address of i -th element beyond a. other side of coin, if pa pointer, expressions may use subscript; pa[i] identical *(pa+i) . in short, an array-and-index expression equivalent 1 written pointer , offset . and after reading this, expect 2 programs work identically: /* program 1 */ #include <stdio.h> int main() { char arr[] = "hello"; ar

python - "TypeError: coercing to Unicode: need string or buffer" while raising an exception -

i'm facing weird exception on production system: typeerror: coercing unicode: need string or buffer, invalidhttpstatuscode found but can't reproduce locally. when log production system , try manually reproduce error works ok. code : import requests requests.exceptions import httperror _session = requests.session() class httpresponseexception(httperror): def __init__(self, response): self.response = response def __str__(self): return 'http request failed status code {}.\n' \ 'url {}\ncontent {}\nheaders {}'.format( self.response.status_code, self.response.url, self.response.content, self.response.headers) class invalidhttpstatuscode(httpresponseexception): pass def get_request(url) response = _session.request('get', url) if response.status_code != 200 ex = invalidhttpstatuscode(response) raise ex get_request('https://my.server.com/re

java - How to distinguish between two JButtons with same name -

Image
i developing swing application need have delete buttons. each delete button clicked perform deletion of row different file depending on button clicked. problem cant not distinguish 2 buttons names both have same name "delete". don't want name them differently may have lot of such delete buttons. there property id or can assign them? avoid use of "switchboard" listeners , instead give each jbutton own action object, 1 created overriding abstractaction. abstractaction objects of same class, has reference file or string collection of interest, delete action performed on correct item. another option associate button object requires action on via hashmap<jbutton, actionabletype> . here 2 examples combined 1 program. jpanel on right contains rows of word pairs delete jbutton, jbutton intimately tied jlabel containing word pairs, since held in common object, wordpairrow. there single actionlistener class added every delete jbutton, passed unique

android - why get text returns false? -

i wrote send username , password, returns false . why? it sent message phone : user:falsepass:false i have tried char , charsequense , string ,... returns false package com.example.project6; import android.app.activity; import android.os.bundle; import android.telephony.gsm.smsmanager; import android.view.view; import android.view.view.onclicklistener; import android.widget.button; import android.widget.edittext; import android.widget.imageview; import android.widget.toast; @suppresswarnings("deprecation") public class login extends activity { private imageview imageview; private edittext username; private edittext password; private button save; private string user; private string pass; @override protected void oncreate(bundle savedinstancestate) { // todo auto-generated method stub super.oncreate(savedinstancestate); setcontentview(r.layout.login); init(); } private void init() { // todo auto-generated method s

javascript - ng-options: how to put empty option at the end? -

currently, i've got (simplified): <select ng-model=model.policyholder ng-options="person.index person.name person in model.insurance.persons"> <option value>someone else </select> this creates dropdown options person names , empty 1 "someone else" @ top. question is, how empty option at bottom of dropdown? i keep using ng-options this, since controlling position of default option seems small change justify more verbose <option ng-repeat> way. thanks! use option value="" like: <select ng-model="model.policyholder" ng-options="person.index person.name person in model.insurance.persons"> <option value="">someone else</option> </select> if want show someone else @ bottom when click on drop-down list can use. <select ng-model="model.policyholder"> <option ng-repeat="person in model.insurance.persons" value=&qu

Difference in android code execution -

i have 2 different devices running same code executing them in different ways. whenever minimize application , pull on tablet works way wanted to, not creating timer. when run on phone though , minimize/maximize timer started, having 2 run @ same time. why work differently on 2 devices or there else happening not seeing. (i know need create background service , way doing incorrect) tablet specs android version: 4.4.2 kernal version: 3.4.67 model number: dl701q phone specs android version: 4.4.2 kernal version: 3.4.0+ software/model: vs450pp1 code main class package temp; import android.app.activity; import android.content.context; import android.content.intent; import android.location.location; import android.net.connectivitymanager; import android.net.networkinfo; import android.net.uri; import android.os.bundle; import android.util.log; import android.view.view; import android.widget.button; import android.widget.imagebutton; import android.widget.textview; impo

Matlab: creating a bigger array using a smaller array -

i have 2 giant array looks like: a = [11, 11, 12, 3, 3, 4, 4, 4 ]; b = [ 12, 4; 3, 11; 11, 1; 4, 13 ]; i want create array takes values b , column 1 like: c = [ 11, 1; 11, 1; 12, 4; 3, 11; 3, 11; 4, 13; 4, 13; 4, 13 ]; i don't want use or other kind of loop optimize process. sorry being terse. i search each element column 1 of in column 1 of b , pick corresponding column 2 elements b , create new array column 1 elements of , discovered column 2 elements b. what doing in problem using a , searching first column of b see if there's match. once there's match, extract out row corresponds matched location in b . repeat rest of values in a . assuming values of a can found in b , first column of b distinct , there no duplicates, can unique call , sortrows call. unique call on a can assign each value in a unique label in sorted order. use these labels index sorted version of b desired result: [~,~,id] = unique(a); bs = sortrows(b); c = b

javascript - How to pass query parameter array using Angular $resource -

i'm trying enable feature users can searched based on multiple tags (an array of tags) using following structure: get '/tags/users?tag[]=test&tag[]=sample' i have working on node server , have tested using postman. issue i'm running how structure get request in angular service using $resource . have found documentation $http stating adding params:{'tag[]': tag} request object trick, cannot find regarding $resource . in angular can pass array query string using $resource in controller: angular.module('myapp').controller('usercontroller',['$scope','userservice', '$location', function($scope, userservice, $location){ $scope.searchquery = {}; $scope.searchusers = function() { $scope.roles = ['admin', 'register', 'authenticate']; $scope.searchquery.name ='xxx'; $scope.searchquery['

javascript - How to call/use this module in other JS files/modules -

i read js module design patterns recently. came across small code snippet below. (function(window) { var module = { data: "i'm happy now!" }; window.module = module; })(window); still not quite understand code well, questions are: how use/call module outside particluar js file? need assign variable module? e.g. var module1 = (...)(...); could explain window parameter here stands for? is practice have two/three such kind of modules in same file? the main reason create anonymous function in case prevent global object pollution. it's not module pattern. the problem arise when declare variable. without function scope, variable added global object (window). if declare variables within function. add variable function scope without polluting global object window. what happen javascript file add variable named foo , on different file use variable named foo too. unless want have variable shared 2 javascript files, create confli

c++ - How to assert in cppunit that a statement throws an exception either of type Excp1 or Excp2? -

cppunit_assert_throw(expression, exceptiontype) not seem allow checking exceptions of multiple types i.e. statement can throw more 1 kind of exceptions. for e.x. expression may throw excp1 on 1 platform, or excp2 on platform. there workaround test such statements using cppunit_assert_throw? first test, make test conditions such throws exeption 1. if fails throw, test failure. if throw, catch exception 1, , accept passing. if throws else, framework catches it. second test, make using conditional compilation enable code platform 2 only. make test conditions such throws exception 2. if fails throw, test failure. if throw, catch exception 2, , accept passing. if throws else, framework catches it. on first platform test passes, there nothing do. on second platform catch exception 2 expected.

type converting C++ std::map into PHP using SWIG -

i have php extension in c++ , used swig wrap it. trying create class implemented in c++ such: package(const std::map<std::string,std::string> &input_map, const std::queue<std::string> &dates_queue); in php using script: <?php require "prq.php"; $input = array("dataset" => "a050119", "station" => "a050119", "flag" => "1"); $dates = array(1 => "read;chunk;2015-07-01 00:00;2015-07-02 00:00"); $package = new package($input, $dates); ?> but error: php fatal error: type error in argument 1 of new_package. expected swigtype_p_std__mapt_std__string_std__string_t in /home/jlahowetz2/development/package-request-queue/swig/prq.php on line 230 which makes sense... have no clue how implement std::map in php. looked @ c++ wrapper created swig , found type conversion this: static swig_type_info _swigt__p_std__mapt_std__string_std__string_t = {"_p_std__mapt_

linux - How can I loop through similar files and then choose another file that corresponds to the file chosen during the loop? -

for shell script how can loop through similar files , while i'm looping through these files choose file corresponds 1 chosen loop @ time? here of code: files=(/home/practice/sm_data.*.model) f in "${files[@]}" infile1="${files[@]}" infile2= (/home/practice/sm_data.*.source) done so, first time goes through loop want choose sm_data. 1 .model (which here) based on want find sm_data. 1 .source. any appreciated!

c# - Very slow runtime with Entity Framework nested loop (using nav properties) -

right now, i'm trying write method survey submission program utilizes normalized schema. i have method meant generate survey team of people, linking several different ef models in process. however, method runs extremely smallest team sizes (taking 11.2 seconds execute 4-person team, , whopping 103.9 seconds 8 person team). after analysis, found 75% of runtime taken in following block of code: var teammembers = db.teammembers.where(m => m.teamid == teamid && m.onteam).tolist(); foreach (teammember teammember in teammembers) { employee employee = db.employees.find(teammember.employeeid); surveyform form = new surveyform(); form.submitter = employee; form.state = "not submitted"; form.surveygroupid = surveygroup.surveygroupid; db.surveyforms.add(form);

javascript - Rails 4: Turbolinks redirect with flash -

lets have standard controller create action: def create @object = object.new(object_params) if @object.save redirect_to @object, flash: {success: "created object successfully."} else render :new end end now if change redirect use turbolinks: redirect_to @object, turbolinks: true, flash: {success: "created object successfully."} the server returns text/javascript response, , browser displaying white page line of text on it: turbolinks.visit('http:/localhost:3000/objects/1'); how make browser executes code instead of displaying text? also, how can flash success message appear? this not direct answer question. suggest using unobtrusive js this. you'd want add remote: true in form first. def create @object = object.new(object_params) if @object.save flash.now.success = 'created object successfully.' else flash.now.alert = @object.errors.full_messages.to_sentence end render :js end crea