Posts

Showing posts from June, 2011

javascript - Mootools wait with Fx.Morph start -

i trying var effect = new fx.morph(testmorph, { wait/delay 2 seconds before starting. ( fiddle here ) but when try .wait(2000) or .delay(2000) , or .wait(2000, effect) uncaught typeerror: object [object object] has no method 'delay' any ideas how working? code i'm using: var testmorph = document.id('testmorph'); var effect = new fx.morph(testmorph, { transition: 'back:out', duration: 900, link: 'chain' }).start({ 'top': 20, 'opacity': 1 }).start({ 'border-color': '#a80025', 'color': '#a80025' }); effect.delay(2000); you can use combination of chain() , delay() achieve desired effect. new fx.morph(testmorph, { transition: 'back:out', duration: 900, link: 'chain' }).start().chain(function(){ this.start.delay(2000,effect,{ //first }); }).chain(function(){ this.start({ //second }); }); the

Android facebook login not working with installed Facebook app -

i have set simple facebook login. android 2.3.6 works should, user gets prompt login dialog, enters data , app goes on. thought android versions fault turs out login isn't working when there facebook application installed on phone! tested on: galaxy ace 2.3.6 htc desire 4.1.2 galaxy note 4.1.2 android emulator 4.1.2 even facebook samples not working! every time app executing - else { log.d("session not opened", "session not opened"); } it seems session isn't opened why that? followed guide - https://developers.facebook.com/docs/getting-started/facebook-sdk-for-android/3.0/ code: session.openactivesession(this, true, new session.statuscallback() { @override public void call(final session session, sessionstate state, exception exception) { if (session.isopened()) { request.executemerequestasync(session, new request.graphusercallback() { @over

magento 1.7 - How to use a helper -

i creating module allows user input details form , save details allow relevant information forwarded them @ specified times. to retrieve details form , add them database followed tutorial , produced code public function saveaction() { $title = $this->getrequest()->getpost('title'); $f_name = $this->getrequest()->getpost('f_name'); $l_name = $this->getrequest()->getpost('l_name'); if ( isset($title) && ($title != '') && isset($f_name) && ($f_name != '') && isset($l_name) && ($l_name != '') ) { $contact = mage::getmodel('prefcentre/prefcentre'); $contact->setdata('title', $title); $contact->setdata('f_name', $f_name); $contact->setdata('l_name', $l_name); $contact->save(); $this->_redirect('prefcentre/index/emailpreferences'); } else { $this-&

c++ - how to initialize an array of std::vector? -

as know, it's normal initialize array of int this: int intary[] = {7, 8, 9}; so, want know, how can initialize array of std::vector in same way (just in initial list): typedef std::vector<int> type; type vecary[] = {vec1, vec2, vec3}; i know it's legal write code fllows, question how initialize vecary in 1 line of code: type vec1; type vec2; type vec3; type vecary = {vec1, vec2, vec3}; in c++11, type vecary[] {{},{},{}}; or if want non-empty vectors type vecary[] {{1,2,3},{4,5,6},{7,8,9}}; if you're stuck in past, can initialise empty vectors: type vecary[] = {type(), type(), type()}; but can't initialise arbitrary values without kind of helper in boost assignment library : type vecary[] = {list_of(1)(2)(3), list_of(4)(5)(6), list_of(7)(8)(9)};

how to find index of the first capital letter in mysql, cyrillic characters -

i have table geographical names of places. have additional letters in front. example if city name astana s.astana . need name of place astana. want use substr , can't find index of first capital letter.owh ya cyrillic characters used problem. want give examples: Акмолинская область -> Акмолинская Кокшетау Г.А. -> Кокшетау г.Кокшетау -> Кокшетау Красноярский с.о. -> Красноярский с.Красный Яр -> Красный Яр what have tried: created field short_nameru , updated way update center_kato ck set ck.short_nameru = case when length(substring_index(ck.nameru , ' ', -1)) > length(substring_index(ck.nameru , ' ',1)) substring_index(ck.nameru , ' ', -1) else substring_index(ck.nameru , ' ',1) end and after updated again update center_kato ck set ck.short_nameru = case when length(substring_index(ck.short_nameru , '.', -1)) > length(substring_index(ck.short_nameru , 

java - Mark current value on axis - jfreecharts -

i'm implementing dynamic charts xyplot , timeseries. i'm continually adding new values chart. how can mark on y axis last added value? custom renderer or simple change font size... ideas? one option add valuemarker plot via addrangemarker() method. this typically add line across plot perpendicular y-axis, shown here .

python - Generic class for functions with any signature c# -

i trying convert python code c# class fwrapper: def __init_ _(self,function,childcount,name): self.function=function self.childcount=childcount self.name=name class node: def __init_ _(self,fw,children): self.function=fw.function self.name=fw.name self.children=children def evaluate(self,inp): results=[n.evaluate(inp) n in self.children] return self.function(results) i finding difficult achieve in c# . 1. in class fwrapper.function can take function signature . 2. obtain return type of function can used mention return type of evaluate function thanks lot not entirely sure trying do, if had this: public class fwrapper<tchild, tresult>{ private int childcount; private string name; private func<tchild, tresult> function; public func<tchild, tresult> function { { return function; } } public fwrapper(func<tchild, tresult>

Why asp.net model binder can not map a string values to a Object property that have the same name -

i have model class named server , have created new servertoedit viewmodel class, follow:- public class servertoedit { public server server { get; set; } [required] public string ipaddress { get; set; } } part of create view is:- model tms.viewmodels.servertoedit @* partial view defines form fields appear when creating , editing entities *@ @html.antiforgerytoken() <div class="editor-label"> @html.labelfor(model => model.server.customername) </div> <div class="editor-field"> @html.editorfor(model =>model.server.customername) @html.validationmessagefor(model =>model.server.customername) </div> <div class="editor-label"> ip address </div> <div class="editor-field"> @html.editorfor(model => model.ipaddress) @html.validationmessagefor(model => model.ipaddress) <

mysql - Transaction necessary for single update query? -

i have mysql query on innodb table this: update items set qty = qty + 5 item_id = 1234 limit 1; do need use transaction this? undesirable happen not using transaction? nothing serious can happen. default, mysql wraps single update/insert/delete commands in transaction. if goes wrong in update, transaction should rolled correctly. you need transactions when combining multiple changes , want them take effect "at same time" or "not @ all". you can read more in documentation .

heroku - Saving third-party images on third-party server -

i writing service part of user chooses image url (not domain) , later , others can view image. i need save image third party server (s3). after lot of wasted time found can not client side due security issues (i can't third party image data , send client side without alerting client, bad) i not want uploading on server because run rails on heroku , workers expansive. though of 2 options: use transloadit.com, or write service on ec2 run on db, find rows images not uploaded , upload them. decided go ec2 , s3 because solution writing meant enterprise , seems sound better part of architecture when presented customers. my question is: setup need can access heroku db external service? any better ideas on how solve this? so want write worker, instead of doing on heroku want on ec2? feels more work. as database, did see documentation ? shows how url. ps. did not find in docs?

c# - Scalable WCF Web Service -

i have written stateless wcf rest web service. main consumer of web service mobile app. there 1000's of clients connecting web service simultaneously. , number increase in future. how deploy wcf web service scales nicely. guessing web service hosted in multiple servers , load balancer distribute traffic among there servers. can suggest load balancer typically used such scenario? is there other recommended way deploy web service scalability? frankly speaking haven't tried this... thought i install microsoft azure service bus windows server , connect/setup available instances of web service service bus endpoint. there buildin load balancer. pros: there build in load balancer, easy.

php - PDOStatement::bindParam && PDOStatement::bindValue not working -

i've been reading lot of posts here in stackoverflow , documentation info @ php dot net. here's code i'm tryng: example 1 $id = 1; $sth = $this->pdo->prepare('select * users_table id_usr = ?'); $sth->execute(array(intval($id))); example 2 $id = 1; $sth = $this->pdo->prepare('select * users_table id_usr = :id'); $sth->bindparam(':id', $id, pdo::param_int); $sth->execute(); example 3 $id = 1; $sth = $this->pdo->prepare('select * users_table id_usr = :id'); $sth->bindvalue(':id', intval($id)); $sth->execute(); if try this: $sth = $this->pdo->prepare('select * users_table id_usr = 1'); $sth->execute(); i result i'm expecting it's not solution i'm looking for. hope can me, in advance. ////////// edit 1 at end of of examples i'm doing this: $arr = $sth->errorinfo(); print_r($arr); the return is: array ( [0] => 00000 [1] => [2] =

sorting - SublimeText - sort json list alphabetically -

i have json formated list of countries , iso codes: . . {"cod":"nc", "nombre":"nueva caledonia"}, {"cod":"ne", "nombre":"níger"}, {"cod":"nf", "nombre":"islas norkfolk"}, {"cod":"ng", "nombre":"nigeria"}, {"cod":"ni", "nombre":"nicaragua"}, {"cod":"nl", "nombre":"países bajos"}, . . the list sorted alphabetically iso code , not name. there way sort list name using sublime text or other editor ? thanks if split "cod" , "nombre" able use sublimetext functional: select text, edit -> sort lines or press f5

asp.net mvc - How to check TempData value in my view after a form post? -

i fill tempdata formcollection , try check value of tempdata in view mvc 4 if statement isn't working expect. here code. controller : [httppost] public actionresult testform(formcollection data) { tempdata["username"] = data["var"].tostring(); //data["var"] == "abcd" return redirecttoaction("index"); } view: @if (tempdata["var"] == "abcd") { <span>check</span> //never displayed } else { @tempdata["var"]; // display "abcd" } this looks simple , don't understand why can't display check . can me ? please try this var tempval = tempdata["var"]; then write if statement follow @if (tempval.tostring() == "abcd") { <span>check</span> //never displayed } else { <span>@tempval</span>; // display "abcd" }

Android activity does not run. Here's the code -

while try start activity, not run. logcat shows following error : 07-25 12:10:46.813: e/androidruntime(797): fatal exception: main 07-25 12:10:46.813: e/androidruntime(797): java.lang.runtimeexception: unable instantiate activity componentinfo{com.example.testingandroid/com.example.testingandroid.dosums}: java.lang.nullpointerexception my code : public class dosums extends activity implements onclicklistener { public radiobutton r1 = (radiobutton) findviewbyid(r.id.doradiobutton1); public radiobutton r2 = (radiobutton) findviewbyid(r.id.doradiobutton2); public radiobutton r3 = (radiobutton) findviewbyid(r.id.doradiobutton3); public radiobutton r4 = (radiobutton) findviewbyid(r.id.doradiobutton4); public edittext et = (edittext) findviewbyid(r.id.doedittext1); //button btnnextscreen = (button) findviewbyid(r.id.button1); timeanddistancem pen = new timeanddistancem(); public string q, a, finalvalue, scale; public double fv; @overri

javascript - Concatenate two fields in one in CRM 2011 -

in form have date field gets current date in mm/dd/yyyy format , field auto-generates number. i want populate field in following format: yyyy-mm-dd-autogenreate number . where year , month , date current dates of form. how do this? , not @ coding if achieved through java script please specific possible. assuming field doesn't have populated when load new entity, add onsave event form: var datefieldvalue= xrm.page.getattribute('datefieldname').getvalue();     var autonum = xrm.page.getattribute('autonumfieldname').getvalue(); /* date formatting guido preite's answer https://community.dynamics.com/crm/f/117/p/109891/218598.aspx#218598 */ // create yyyy-mm-dd string var year = datefieldvalue.getfullyear()+""; var month = (datefieldvalue.getmonth()+1)+""; var day = datefieldvalue.getdate()+""; var dateformat = year + "-" + month + "-" + day; xrm.page.getattribute('otherfield').se

javascript - Add css attribute to element -

i want add css attributes element. when code down here loose attributes had impact on element. function checknr(id) { var value = document.getelementbyid(id).value; if (parsefloat(value) == nan) { document.getelementbyid(id).setattribute("style", "border:2px solid red; background-color: rgb(255, 125, 115);"); } else { document.getelementbyid(id).setattribute("style", "border:default; background-color: rgb(255, 255, 255);"); } } before use method have attributes: float: left; width: 50px; and afterward got specific attributes javascript method. so, want add attributes not replace them. setting style attribute that, overwrites attribute , removes set styles. what should set styles directly instead changing style property : function checknr(id) { var elem = document.getelementbyid(id), value = elem.value; if (parsefloat(value) == nan) { elem.style.border = '2

iphone - in app purchase is not working properly. It gives "Can not connect to itunes" -

when performing in app purchase, shows "can not connect itunes". i.e goes "fail transaction method" , after few seconds goes "complete transaction method". want handle both case separately. please help. this problem, displayed in iphone simulators. try testing application on device. pretty sure, problem not present inapp purchases.

jquery - Issue with P tag content covering a block level link -

i've been going insane j-query slider adapted juliendecaudin's barousel plugin i've put on jsfiddle: http://jsfiddle.net/psfms the 4 navigation blocks created jquery code (which why i'm having problem). because needed text on each blocks, added p tags code , positioned them on each block. meant covered links, , consequently hover effects stop. i have tried multiple things thought make work limited jquery knowledge have (when hover on p tag, show relevant background image @ correct width , height , positioned, instance) none have worked! what love know how make text act link navigation blocks, also, make when hover on text, background image hovers too. alternatively if there's way fuse 2 swell! the html bit added p-tags here (the jquery code automatically creates html ul li elements: <div class="barousel_nav"> <p class="abs abs1">value proposition development</p> <p class="abs abs2">sales engage

c# - How to avoid N+1 in EF generated queries -

Image
i used generate helper tables usergroupusers many-to-many relations or relational ids in poco myself want ef take care of them. don't think it's such idea after all. problem when try usergroupdynamicfield particular user generates n+1 query every usergroup user in. here overcommed problem stating usergroups iqueriable instead of ienumerable . cannot because ef won't map it, has icollection . code public class user { ... public virtual icollection<usergroup> usergroups { get; set; } public ienumerable<userfield> fields { { var fields = this.usergroups.selectmany(x => x.usergroupdynamicfields); // n + 1 every usergroup foreach (var field in fields) { yield return new userfield { name = field.name }; } } } } database here overcommed problem stating usergroups iqueriab

c++ - How to check why file is not opened? -

std::ifstream fin; fin.open("file.txt", std::ios::in); std::cout << fin.is_open(); this code prints false file not opened. how check why it. maybe error message fin object? guessing reason file opened writing. want open reading. possible open file both reading , writing.? i using linux. strerror(errno) error no such file or directory file exists. maybe error because opened using other object? opened using c api, therefore fin cant open it. how can open file opened? the standard specifies there preprocessor symbol errno , expands references (thread local) int , in system functions expected put extended error code. defines function strerror , allow recovering char const* text message, given number (but unlike errno , function not guaranteed thread safe). the standard not place requirements on filebuf use errno , @ least not in case of open , in practice, filebuf invoke lower level functions (hopefully) use errno . (this required posix, of syst

php - need soting multi dimensional array based on another array displaying order -

i need sorting array based array sort value. actual array : array(name=>'jk',age=>'20',place=>'india',year=>array(marks1=>array(sub1=>50,sub3=>70,sub7=>65,sub5=>75,sub4=>35), marks2=>array(sub8=>50,sub10=>70,sub12=>75,sub9=>35,sub11=>65)) sorting order array : array(name=>1,year=>2,age=>3,place=>4,sub1=>5,sub3=>6,sub4=>7,sub5=>8,sub7=>9,sub8=>10,sub9=>11,sub10=>12,sub11=>13,sub12=>14) expected result array: array( name=>'jk', year=>array( marks1=>array( sub1=>50, sub3=>70, sub4=>35, sub5=>75 sub7=>65 ), marks2=>array( sub8=>50, sub9=>35, sub10=>70, sub11=>65, sub12=>75 ), age=>'20', place=>'india' ) i hope :) $a

c# - Parse datetime in multiple formats -

i have created api end-point. caller may call api post method passing relevant parameters. in parameters there 1 parameter of datetime format. the problem when calling api caller may passes datetime in 3 different formats: long int - e.g. 1374755180 us format - e.g. "7/25/2013 6:37:31 pm" (as string ) timestamp format - e.g. "2013-07-25 14:26:00" (as string ) i have parse datetime value , convert datetime or string in timestamp format. i have tried using datetime.tryparse() , datetime.parse() , convert.todatetime() , convert.todouble() none of them working in certainty me. the required output has in en-gb format. edit: i had thought have if-else if-else block use tryparse 3 times 1 else string not parsed. best solution? or there solutions better this? please help! you should consider requiring timezone. 1 doesn't need it, #2 , #3 do. public datetime parserequestdate() { // https://stackoverflow.com/questions/28

Sending DTMF tones in between outgoing call create call in 3 way mode in android -

when outgoing call event fire, after sometime call sending dtmf tones, when dtmf tones send, previous call going hold , new call generated, , generate 3 way calling in android. can call not generate 3 way code? code of sending dtmf is: tonegenerator tone = new tonegenerator(audiomanager.stream_dtmf,tonegenerator.max_volume >> 1); tone.starttone(tonegenerator.tone_dtmf_1); tone.starttone(tonegenerator.tone_dtmf_2); tone.starttone(tonegenerator.tone_dtmf_3); tone.starttone(tonegenerator.tone_dtmf_4); tone.starttone(tonegenerator.tone_dtmf_5); tone.starttone(tonegenerator.tone_dtmf_6); tone.starttone(tonegenerator.tone_dtmf_7); tone.starttone(tonegenerator.tone_dtmf_8); tone.starttone(tonegenerator.tone_dtmf_9); tone.starttone(tonegenerator.tone_dtmf_p); tone.starttone(tonegenerator.tone_dtmf_s); tone.stoptone(); concatenate_tonevalue = ("tel://"); (i = 0; < j; i++) { value = string.valueof(param.charat(i)); try { parsetonevalue

c# - XmlSchemaElement class properties meaning -

maybe missed something, can explain me meaning , differences of following properties of xmlschemaelement class: what differences between x mlschemaelement.elementschematype , xmlschemaelement.elementtype ? what differences between qualifiedname, schematypename , refname ? how qualifiedname, schematypename , refname related each other? when schematypename.isempty == true , mean refname.isempty == false ? is possible *names empty , mean, embedded complextype? in general need parse xsd , map result internal structure, need rules, allows me generate different types of object. let's if (schematypename.isempty) in elementschematype have simpletype restrictions provided. xmlschemaelement.elementtype obsolete since 2.0, otherwise they're same. qualifiedname represents actual qualified name of element, corresponding xml element in xml instance document have it. schematypename represents name of type given element (could built in xsd such int or user de

command line interface - CakePHP CLI Commandline execution -

i want execute commandline using cakephp-cli. want build function executes application using command-line. cant find useful in documentation. did else got issue before? thanks alot. edit i have created cli-class called database database synchronising functions in there. want use external tool called "liquibase". executed using commandline. java -jar liquibase.jar -parameter1 -parameter2 the problem have no idea how execute such command-line out of cakephp-cli. i tried $this->runcommand("echo 'test'"); but output isn't displayed. runcommand intended running (cake) shell / task methods, see . if want execute external commands use exec , see .

jsf 2 - How to validate particular fields in a form before saving the entire form in Primefaces -

i have jsf form save data,in form there fileuploaded component of primefaces, each , every file upload, has particular description. using event listener operation.now requirement want restrict user when upload file without adding description has display validation message "please add description" process should done before submit whole form. source code: <h:panelgrid id="ff" columns="2" cellpadding="8"> <p:outputlabel for="file" value="description:" styleclass="label" style="font-weight:bold" /> <p:inputtextarea rows="5" cols="30" id="file" value="#{manageproject.desc}" required="true" requiredmessage="please enter file desccription" styleclass="input"

javascript - AngularJS Directive Template URL Requires Leading Slash, Breaks Tests -

'use strict'; directives.directive('primaryclient', function() { return { restrict: 'a', templateurl: 'views/directives/primary-client.html', scope: { 'client': '=' } }; }); i've got simple directive replaces element contents of template file. shown above, it's broken. error in chrome error: unexpected request: views/directives/primary-client.html . adding leading slash (i.e. /views/directives/primary-client.html ) fixes problem. however in tests, absolutely unable working leading slash. file loaded , passing test when omit leading slash, of course breaks actual functionality. i can share more code tests if needed, examples of tests loaded templates seem show directive omitting leading slash. i've got <base href="/"> set in index.html. there i'm doing wrong that's forcing leading slash? i ran issue relative paths , tests. in directives have leading sla

android - I want to create custom arc shape button -

Image
i want create , save button buttons in image below. tried did not find solution. not want use image button. please me.. here image of , save button..

Styling javascript function *show/hide* CSS/HTML/JS -

Image
how style read more , show less? ive tried styling #tag1 alters 'read more' text first appears heres js <script> function toggleandchangetext(divid, tagid) { $("#"+divid).toggle(); if ($("#"+divid).css('display') == 'none') { $('#'+tagid).html('read more <i class="icon-circle-arrow-down"></i>'); } else { $('#'+tagid).html('show less <i class="icon-circle-arrow-up"></i>'); } } and html <a id="tag1" href="javascript:toggleandchangetext('a1', 'tag1');"> <p>read more <i class="icon-circle-arrow-down"></i></p> </a> here text looks during every section... the first 1 when first see button. user clicks on , 'show less' appears can see button further left , less padding on bottom. when user goes clo

c# - Custom control - can't receive focus or mouse events -

i have created winforms custom control, , while can receive mousewheel messages fine , none of mousedown, mousemove, or mouseup messages received. i have set following controlstyles: setstyle(controlstyles.userpaint | controlstyles.optimizeddoublebuffer | controlstyles.allpaintinginwmpaint, true); (i have tried setting controlstyles.selectable , controlstyles.usermouse , makes no difference) i have put code in gotfocus , lostfocus events, , can see in circumstances control focus, lose again immediately. this gis map viewer / editor control, , must able receive focus, both can receive mouse events, can use hotkeys perform various actions. any ideas? [edit: here's code demonstrates this. question guess identical setting focus .net usercontrol...? , wasn't answered satisfactorily. ] public partial class customcontrol1 : control { public customcontrol1() { setstyle(controlstyles.userpaint | controlstyles.optimizeddoublebuffer | controlstyles.

Java code Multiple Thread, Wait to start other -

i trying find out, after complete first thread start second thread, after complete second thread start third thread, please me!! here code: public class wait { /** * @param args */ public static void main(string[] args) { // todo auto-generated method stub system.out.println("first thread"); createtheard2(); } public static void createtheard2() { try { system.out.println("second thread"); } catch(exception error1) { error1.printstacktrace(); } createtheard3(); } public static void createtheard3() { try { system.out.println("third thread"); } catch(exception error1) { error1.printstacktrace(); } } } after complete first thread, start second thread, after complete second thread, start third thread, please me!! thanks!! implement runnable public class threaddemo i

Linq to SQL - Left Outer Join multiple conditions and show all columns -

Image
i have perused other questions regarding linking tables in linq left joins using multiple conditions , tried thought relevant examples can't create c# linq code results need. i have 2 tables. first productionoptions , second productionorderdetailsoptions. this contents of productionoptions table (filtered optiontype brevity) optiontype optionvalue order showtextbox ---------------------------------------------------------- packaging black box 8 false packaging custom folding logo 4 true packaging flannel dust bag 6 false packaging folding 2 false packaging image folding 1 false packaging navy box 9 false packaging other 13 true packaging plain folding 3 false packaging polybag 5 false packaging set box black 11 true packaging set box cream 10 true packagi

theming - Drupal 7 node.tpl and page.tpl not rendering variables -

i'm working on website drupal 7. have encountered problem when trying build tpl file. have content type named project(machine name: project) , , want custom node.tpl.php , page.tpl.php . using zen theme, i've created files named node--project.tpl.php , page--project.tpl.php . thing when try render field using $node doesnt show up, stays blank, when try see $node using dpm($node) (from devel module), doesnt show anything. can problem ? frustrating.

java - How to use inputstream mark and reset functions? -

i'm trying read first 8192 bytes file , run bytes through method returns boolean. that boolean tells me if file of particular type. if method returns true on bytes file type want remaining bytes , run them through different method. if false, run remaining bytes through different method. i'm trying use mark, having no success. private final void handlefile(inputstream inputstream) { bufferedinputstream bis = new bufferedinputstream(inputstream); bis.mark(8192); byte[] startingbytes = inputstreamtobytearray(bis); if(startingbytes.length == 0) { return; } byte[] finalbytes; if(isfiletype(startingbytes)) { bis.reset(); finalbytes = inputstreamtobytearray(bis); methodforfinalbytes(finalbytes); } else { // other stuff; } } private byte[] inputstreamtobytearray(inputstream inputstream) { bytearrayoutputstream baos = new bytearrayoutputstream(); byte[] buffer = new byte[8192]; try { while(inputstream.rea

How to use signalr v2 beta in asp.net mvc 4 -

before v2: routetable.routes.maphubs(); in v2, maphubs not exist anymore. wiki says add startup class , configuration method , call app.maphubs(). namespace myassembly { public class startup { public void configuration(iappbuilder app) { //before v2 //routetable.routes.maphubs(); app.maphubs(); } } } but method never called, no error occurs, , ... no hub setup. i suppose there code add global.asax.cs what secret ? try defining [assembly : owinstartup(typeof(myassembly.startup))] see if startup class being picked up.

How to use a C++ singleton to return an object initialized only once -

i real c++ noob, please patient me. first lets set stage. i have c++ source in binary.cpp compiles binary looks like: # include "lotsofheaders.h" int main(int argc, char* argv[]) { int errorcode = foobar_global_unknown; // foobar instanciation foobar foobar(); // multiple calls :send_auth passing in foobar instance errorcode = send_auth(getx(), gety(), foobar); errorcode = send_auth(getx(), gety(), foobar); errorcode = send_auth(getx(), gety(), foobar); return errorcode == foobar_ok ? exit_success : exit_failure; } the send_auth method loaded object code file , gets passed instance of foobar. reason is, foobar comes api object not have source of , must not instantiated more once. since main called once, works expected: there 1 instance of foobar , send_auth can called multiple times. the binary not of use me, need shared object library same. creates 1 instance of foobar , exposes external interface method send_with_auth ca

Python - make a dictionary from a csv file with multiple categories -

i trying make dictionary csv file in python, have multiple categories. want keys id numbers, , values name of items. here text file: "id#","name","quantity","price" "1","hello kitty","4","9999" "2","rilakkuma","3","999" "3","keroppi","5","1000" "4","korilakkuma","6","699" and have far: txt = open("hk.txt","ru") file_data = txt.read() lst = [] #first make list, , convert dictionary. key in file_data: k = key.split(",") lst.append((k[0],k[1])) dic = dict(lst) print(dic) this prints empty list though. want keys id#, , values names of products. make dictionary names keys , id#'s values, think same thing other way around. you can use dictionary directly: dictionary = {} file_data.readline() # skip first line

Python: For statement to display a list with specific strings? -

i'm new python , trying learn use statement display information in way.... there way use statement display list this? w = "fa1/1 connected 42 a-full a-100 10/100basetx" v = w.split() x=v[0] print "port ", x y=v[1] print "status ", y z=v[2] print "vlan ", z a=v[3] print "duplex ", b=v[4] print "speed ", b c=v[5] print "type ", c ------------------------- port fa1/1 status connected vlan 42 duplex a-full speed a-100 type 10/100basetx i have tried lot of different methods keep getting value , index errors.... thanks help.... something this? >>> w = "fa1/1 connected 42 a-full a-100 10/100basetx" >>> firstlist = ['port', 'status', 'vlan', 'duplex', 'speed', 'type'] >>> testlist = zip(firstlist, w.split()) >>> a,

Video plays upside down when recorded from Front Camera in Android -

i doing android video camera application. should have capability of recording , front camera. done camera , fine. when record front camera, video plays upside down. have play videos recorded in application itself. using videoview, how set orientation or make play correctly?. video when played in default media player playing upside down. tried sending video iphone , checked still plays upside down. have setorientationhint mediarecorder no solution. all code similar agargenta's video capture demo in have done customization. issues seems strange , struck. this.mediarecorder = new mediarecorder(); this.mediarecorder.setcamera(this.mcamera); this.mediarecorder.setaudiosource(mediarecorder.audiosource.camcorder); this.mediarecorder.setvideosource(mediarecorder.videosource.camera); if (build.version.sdk_int <= 10) { camcorderprofile camcorderprofile = camcorderprofile .get(camcorderprofile.quality_high);

ruby on rails - "missing required :bucket option" for Paperclip/S3 -

in rails app i'm letting users upload image when create "release", , should upload directly s3. i'm getting following error in both development , production. edit: should note error happens when trying upload release edit page on form submit. argumenterror in releasescontroller#update missing required :bucket option rails.root: /users/jasondemeuse/pressed i've done before no issues using carrierwave, can't figure out i'm doing wrong i'm using paperclip. of fixes i've seen on , elsewhere heroku issues, i'm getting same problem on development , none of fixes have helped. here's relevant code ("..." indicates not relevant snippets): development.rb appname::application.configure ... config.paperclip_defaults = { :storage => :s3, :s3_protocol => 'http', :s3_credentials => { :bucket => env['aws_bucket'], :access_key_id => env['aws_access_key_id'],

mysql - Build complex result table with dynamic columns -

i have question - trying find solution here, see not situation. so: in table1 have article descriptions id | name 1 | doors 2 | chairs in table2 have article properties id |id_article | descr 1 |1 | type 2 |1 | material 3 |2 | height 4 |2 | width 5 |2 | toll in table3 have article list properties values like article | id_art_descr | id_art_prop | value model1 | 1 | 1 | solid model1 | 1 | 2 | wood model2 | 1 | 1 | solid model2 | 1 | 2 | steel the goal build table, list article given group properties group. example, doors, table must have columns: article | type | material model1 | solid | wood model2 | solid | steel for chairs, table must have other columns: article | height | width | toll ........ so every article group, columns count , lables different. write script on aspx , php this, method have difficults s

javascript - Chat App - Testing interaction between two clients -

i'm writing html/js (ember) chat app using socket.io backend. (i know: original, much? ) for of end end integration tests (i.e. client , server) test interaction between 2 clients. know can done selenium-webdriver , testing framework such mocha i'd use nice test runner karma or 1 comes qunit , i'm bit stumped how either of create , interact 2 clients @ once. qunit in not test runner. testing framework. karma on other hand, test runner. qunit likes test units of code, xunit framework does. running integration tests in unit-testing settings not advisable. comment below andy demonstrates , qunit can used in different settings, there not in sense of xunit -type testing framework. as testing socket.io applications, this answer might helpful you? swizec teller has tutorial on testing socket.io code, , liam kaufman has blog post on testing chat application written socket.io.

vba - Use msvbvm60 from 64 bit code -

in 32-bit versions of office use getmem2, getmem4, , getmem8 functions msvbvm60.dll: public declare ptrsafe sub mem_read2 lib "msvbvm60" _ alias "getmem2" (byref source any, byref destination any) public declare ptrsafe sub mem_read4 lib "msvbvm60" _ alias "getmem4" (byref source any, byref destination any) public declare ptrsafe sub mem_read8 lib "msvbvm60" _ alias "getmem8" (byref source any, byref destination any) these api declarations not work in 64-bit office. when attempt invoke of these functions error runtime error '48': file not found: msvbvm60 i'm using office 2013 on windows 8, , msvbvm60.dll installed in syswow64. did try copying msvbvm60.dll directly system32 , registering there using system32 version of regsvr32, still did not work. there way use declared functions in 32-bit dlls 64-bit office? also, using 'msvbvm60.dll' or 'c:\windows\system32\msvbvm60.dll'

sql - Wrong values being updated in MySQL -

$salt2i working on login system , having problem updating salt tables. not expert in sql know way around. my query update is: update hashtable set `salt1` = 'salt1here' , `salt2` = 'salt2here' `userid` = userid userid integer value don't need quote that. when update table salt1 set value of 0 . using php create sql query , looks like: update hashtable set `salt1` = '$salt1' , `$salt2` = 'salt2here' `userid` = $userid side note: know sql injection , have protection against in code. in case not need because salt values being generated script , user id value returned function. place have user input strip slashes , have ways prevent injection. to me sql query seems correct , know values correct because dynamically created query looks like: update hashtable set `salt1` = '9d6db1743e5e0cf1bb0e8cd799c0640231a10ec21e1612a6ed46e8ea16862835' , `salt2` = '0824b2aac446ccfbd719645f84b13443cbcf59ee4e6dabace8c421ff

How do I represent a "standard" Javascript object constructor (new ()) in TypeScript when I can't modify the original Javascript? -

i'm working on project add type annotations (a .d.ts file) large existing javascript code base. .d.ts file live alongside javascript, can't make changes javascript support project. in existing code, there's this: ... window.myglobal.service = function () { } window.myglobal.service.prototype = { baseurl: 'http://...'; } ... with expectation we'll later var svc = new window.myglobal.service(); i can't figure out how represent in typescript. have interface service { baseurl: string; } but i'm not sure put in interface myglobal. i've tried interface myglobal { service: service; } but can't use new() on that. can change interface myglobal { service(): void; } and let me use new(); loses type information service interface. is possible handle situation in typescript? option 1: declare module myglobal { class service { baseurl: string; } } interface window { myglobal: {