Posts

Showing posts from July, 2013

QT Creator build and rebuild -

i have 2 projects qt-creator c++. let's call project , project b. project works fine. project b strange. last week when tried debug it, stuck. re-saved .pro file (not changing anything) , works. every time build , debug (which build , run ), qt rebuild all. creates moc_blabla.o again every time build it. when debug project b, qt rebuild , run, not build , run. in project works fine. project a.pro , project b.pro have same architecture, no special configuration, default. there wrong did in project b? there way can normal build in project b again? qt creator gets things mixed up, instance, when have hand-edited project file. if project acts strangely close projects , editors in qt creator , delete intermediate files (*.obj, .o, ...) , outputs ( .exe, *.dll, *.lib, *.dylib, ...) produced project. also, delete .pro.user file(s). last step force qt creator configure project anew (and create new .pro.user file). all of above might achieved through make clean or qt cre

javascript - Passing dynamic field names to jquery's each method -

i'm trying pass field name dynamically function in order form use autocomplete. call function in page keep getting error , think it's because it's trying column property literally opposed dynamically. in php {$fieldname}. there javascript equivalent? or getting horribly wrong? // call function index.php inputsuggetion('input.search', 'http://myapi.com/endpoint', 'title') // function function inputsuggestion(element, endpoint, fieldname) { $(element).on("keydown", function(event) { $.ajax({ type: 'get', datatype: "json", data: { q: $(element).val() }, url: endpoint, success: function(data) { var apicollection = []; $.each(data, function(key, value) { apicollection.push(value.fieldname); }); $(".autocomplete").autocomplete({

html - Insert a custom font in CSS -

this question has answer here: how add non-standard font website? 20 answers i'm new css. want use helvetica neue font in little project. have downloaded .ttf file , tried insert through @font-face rule: @font-face{ font-family:"helvetica neue light"; src:url("contenuti/helveticaneue-light.ttf"); /*that's put it*/ } to apply used: .xyz{ font-family:"helvetica neue light"; /*...other things...*/ } the problem neither safari or chrome display it what do? try using dash between neue , light. this: font-family:"helvetica neue-light";

tsql - Select Parent..Child records from 2 tables in one query -

i have 2 tables called yl0pf (which master or parent record) , yl1pf (which detail or child record). they join yl0ab=yl1ab, yl0an=yl1an, yl0as=yl1as and restrict records column dteinp. there can 0 many detail records 1 master record. child records arrears records showing months payments have been missed month due so can of course this: select y0.* , y1.* alpsproduction..yl0pf y0 left outer join alpsproduction..yl1pf y1 on y0.l0ab = y1.l1ab , y0.l0an = y1.l1an , y0.l0as = y1.l1as y0.dteinp = '01 jun 2015' order y0.l0ab + y0.l0an + y0.l0as , y1.l1ab + y1.l1an + y1.l1as , cast(y1.dteinp date) desc and put child records next repeating parent records. but if possible extract data below: l0as1, l0an1, l0as1, * l1as1, l1an1, l1as1, * l1as1, l1an1, l1as1, * l0as2, l0an2, l0as2, * l

c++ - Universal reference with templated class -

example: template <typename t> class bar { public: void foo(t&& arg) { std::forward<t>(arg); } }; bar<int> bar; bar.foo(10); // works int a{ 10 }; bar.foo(a); // error c2664: cannot convert argument 1 'int' 'int &&' it seems universal references works only templated functions , only type deduction, right? make no sense use class? , using of std::forward makes sense in case? note preferred terminology (i.e. 1 in future versions of spec) forwarding reference . as say, forwarding reference works type deduction in function template. in case, when t&& , t int . can't int& because has been explicitly stated in bar instantiation. such, reference-collapsing rules can't occur, can't perfect forwarding. if want perfect forwarding in member function that, need have member function template: template <typename u> void foo(u&& arg) { std::forward<u&g

javascript - Add script to assetbundle in HTML -

i'm working on project uses unity webgl display different machines/parts/.. in 3d, these parts or machines selected user , loaded scene (for there single scene, might want load scenes dynamically also). because of large amount of choices want create different asset bundles, containing 1 or more parts each, can download these on-demand. i've done passing url loadfromcacheordownload , extracting gameobject www object. now include scripts assets create animations , user interaction. followed explanation given here: docs.unity3d link , , this works in webplayer . end requirement webgl, , same code built webgl gives following error: notsupportedexception: /users/builduser/buildslave/unity/build/tools/il2cpp/il2cpp/libil2cpp/icalls/mscorlib/system/appdomain.cpp(184) : unsupported internal call il2cpp:appdomain::loadassemblyraw - "this icall not supported il2cpp." system.appdomain.loadassemblyraw (system.byte[] rawassembly, system.byte[] rawsymbolstore

php - Saving mysql data in binary -

is there way retrieve data mysql db table , save them in binary file? my table looks this id domain_name isauth 1 www.yah.com 1 2 www.go.com 0 3 www.goo.com 1 4 www.foo.com 1 since performance seems issue here, assuming $data result of call pdostatement::fetchall or mysqli_fetch_all , suggest serialize , unserialize : /* fetch $data */ file_put_contents('my_file.dat', serialize($data)); /* other stuff */ $data = unserialize(file_get_contents('my_file.dat')); /* use $data */

c# - DOT.NET System.Data.Entity.DbContext, mapping parent to child but not child to parent -

i'm using npgsql.entityframework , due aspects of implementation of xmlserializer want custom handling of mapping. instead of standard method of mapping child parent (as parent) want child mapped using parent_id (as long). i want keep function of adding child parent in model, want able handle child(s) without loading parent. code in vb.net (answers c# or vb) example parent add: dim p new parent p.child.add( new child ) example child add without parent loaded, parent id known, dim c new child c.parent_id= known_parent_id any appreciated. public class parent private m_childs icollection(of child) <runtime.serialization.datamember(), componentmodel.dataannotations.key> public property id long public overridable property childs() icollection(of child) return m_childs end set(value icollection(of child)) m_childs = value end set end property end class public class child <runtime.serialization.datamember(), compone

asp.net mvc - How to get value from interface? -

i have : public class usercontactinformation : iusercontactinformation { public bool isdefaultcontactinformation { get; set; } public string email { get; set; } } and interface: public interface iusercontactinformation { bool isdefaultcontactinformation { get; set; } string email { get; set; } string phone { get; set; } } how can email in controller because don't see usercontactinformation in controller. it's not visible. need function getemail() ? can`t use this: model.email = user.usercontactinformation.email; your code invalid won't compile because can't have phone defined in interface , fail implement in class has defined. public interface iusercontactinformation { bool isdefaultcontactinformation { get; set; } string email { get; set; } string phone { get; set; } } // invalid public class usercontactinformation : iusercontactinformation { public bool isdefaultcontactinformation { get; set; } public

php - Laravel 5 FTP Upload -

i'm working on laravel project uses ftp service, used https://github.com/harishanchu/laravel-ftp . can't make upload work. have proper connection , able make new directories remote server. upload doesn't work. doin wrong parameters? $ftp_upload = ftp::connection()->uploadfile($file_loc, $current_dir); when var_dump() $file_loc string 'c:\wamp\www\callrec\public\uploads\joene1212\01313313116_soniasantos482uk_2015-04-28-20-22-25.wav' which totally exists in directory , $current_dir in remote directory is string '/callrecordingsupload/joene1212' where $file_loc local source , $file_loc remote directory uploaded. if making directories not uploading file, chances php file upload limits set @ default 2mb. try adding following lines .htaccess memory_limit = 512m upload_max_filesize = 100m post_max_size = 100m

dialog - App crashes on screen rotation when android.support.v7.app.AlertDialog is displayed and screen is rotated -

i have read related questions problem , tried (including using setretaininstance ) , have not managed find works. pared dialogfragment bone (see below) , still have problem. having read blog elsewhere in author states has tried on stackoverflow without success, have decided did , dismiss dialogfragment in onstop , recreate in onstart. thought ask in case there new solution problem. debugging in android studio receive unfortunately app has stopped message, there not trapped exception , no logcat output. here reduced code still fails: import android.app.activity; import android.app.dialog; import android.app.dialogfragment; import android.os.bundle; import android.support.annotation.nullable; import android.support.v7.app.alertdialog; public class textviewdialogfragment extends dialogfragment { public textviewdialogfragment() { super(); } static public textviewdialogfragment newinstance(int title, @nullable string message, int identifier, int inputtype

apache - Php encrypt url -

i need , using codeigniter php url encryption, i use default codeigniter encryption class , without changing configuration, but when encrypt url show me error "object not found , request url not found on server" the way encrypt url $e_email_app = $this->encryption->encrypt($email_app); $e_email_app = urlencode($e_email_app); $newurl = base_url()."job_applicant/fill_data/".$e_email_app; i enable apache mod_rewrite on http.conf , using virtual host this <virtualhost *:83> serveradmin 192.168.77.204:83 documentroot "c:/xampp/htdocs/vacancy/public" <directory "c:/xampp/htdocs/vacancy/public"> options indexes followsymlinks includes execcgi allowoverride order allow,deny allow </directory> errorlog "logs/dummy-host2.example.com-error.log" customlog "logs/dummy-host2.example.com-access.log" common </virtualhost> and .htacess r

ios - Add UIPickerView inside UITableview -

how can add uipickerview inside uitableviewcell? is there new inlinepicker or try add subview in cell? please answer question & remove confusion/doubt inlinepicker apple has given sample code datecell here code snippet of : - (bool)haspickerforindexpath:(nsindexpath *)indexpath { bool hasdatepicker = no; nsinteger targetedrow = indexpath.row; targetedrow++; uitableviewcell *checkdatepickercell = [self.tableview cellforrowatindexpath:[nsindexpath indexpathforrow:targetedrow insection:0]]; uidatepicker *checkdatepicker = (uidatepicker *)[checkdatepickercell viewwithtag:kdatepickertag]; hasdatepicker = (checkdatepicker != nil); return hasdatepicker; } - (void)updatedatepicker { if (self.datepickerindexpath != nil) { uitableviewcell *associateddatepickercell = [self.tableview cellforrowatindexpath:self.datepickerindexpath]; uidatepicker *targeteddatepicker = (uidatepicker *)[associateddatepickercell view

asp.net mvc - Why my ajax call do not work? -

i not able detect why ajax call not work. trying read contents of text file not work, problem control never go .done(function(data)) function makecustomertree() { // debugger alert('customertree'); $.ajax( { url:"~/bootstrap/js/livemap/ajax/jsonstringcarryingdata/customer-tree-json.txt", data: {}, type: "get" }).done(function (data) { alert('done'); $('#tree_loader').html(''); tree = $.fn.ztree.init($("#customertree"), setting, data); tree = $.fn.ztree.getztreeobj("customertree"); }).fail(function (jqxhr) { alert('fail'); $('#tree_loader').html('<font color="red">unable load.</font>');//jqxhr.responsetext); }); } where file customer-tree-json.txt contains contents this:

Why does respond_to? need symbols as arguments in Ruby? -

why method accept symbols , not strings arguments? x = 10 x.respond_to?(next) pushing string above throw (ruby):1: void value expression . it accept strings: x = 10 x.respond_to?('next') # => true your problem didn't pass string, next keyword.

Beginner While loop error in MySQL -

i have looked @ various guides on mysql while loops , still can't figure out doing wrong. mysql> delimiter $$ mysql> create procedure insertrooms() -> begin -> declare nroom int default 101; -> while nroom < 109 -> insert simple_room (room_number) values nroom; -> set nroom = nroom + 1; -> end while; -> end; -> $$ error 1064 (42000): have error in sql syntax; check manual corresponds mysql server version right syntax use near 'nroom ; set nroom = nroom + 1; end while; end' @ line 5 i trying while loop insert rooms 101 - 108 simple_room table. appreciated, have tried searching on google , stackoverflow , not find why keep getting syntax error. using mysql version 5.6.24. your query correct except forgot using brackets around nromm . try this, mysql> delimiter $$ mysql> create procedure insertrooms() -> begin -> declare nroom int default 101; -> while nroom < 109 -> insert simple_room (room_number) value

javascript - Get value between matching tags? (CodeMirror) -

i'm using codemirror 5.3. i'm tag matching html in mixed-mode document highlight start , end tags - works well. ( https://codemirror.net/demo/matchtags.html ) i'm trying capture content between markers (in case using context-menu action right-click on tags), can send off external process. i use var tm = doc.getallmarks(); , because i'm tag matching , not bookmarking, pretty know there's going 2 items in array. however, textmarker array returns doesn't (as far can tell) contain {line, ch} cursors marks. is there proper way starting , ending positions of marks - either directly or lines , character positions? best can think of iterating each: [].lines[0].parent.lines and looking see if each instance of codemirror.line has markedspans object, give me line index, , use [].lines[0].markedspans[0].from , [].lines[0].markedspans[0].to find positions of characters in mark. , use doc.getrange grab content , shuffle off processing... this: var tm =

ruby on rails - How to check in PayPal is payment valid? -

after payment next url: http://www.website.com/en/success?tx=some_value&st=completed&amt=some_value&cc=usd&cm=&item_number= with variables in _get, can check payment valid or not? so, user pay or randomly create url himself? i recommend setting ipn solution.

windows - Not able to update Android SDK Manager -

Image
not able update android sdk manager !!! i working behind corporate proxy. proxy setting done using script. have checked script , found domain proxy setting made "direct". now in condition, when trying update sdk manager, not able update. getting error below . ** fetching url: https://dl-ssl.google.com/android/repository/repository-10.xml download interrupted: connection https://dl-ssl.google.com refused ** but when trying access https://dl-ssl.google.com/android/repository/repository-10.xml using browser, able xml file. it seems me need update tools > option > proxy setting in sdk manager. not able find way set same in case (when proxy setting set direct). please me set , resolve issue. thanks ajoy sinha if have issue ssl can try following. else try replicate proxy settings of browser sdk mangers settings.

javascript - When Listening to Ctrl + B event, Bookmark tab shows up -

i trying implement ctrl+b contenteditable div should make text bold. the problem i'm getting when ctrl+b pressed, browser's bookmark tab appears. ( fiddle ) $(document).ready(function() { $('#editable').designmode = 'on'; $('#editable').on('keyup', function(e) { console.log(e.which); if(e.which == 66 && e.ctrlkey) { e.preventdefault(); console.log('bold'); document.execcommand ('bold', false, null); return false; } }); }); #editable { width:200px; height:100px; border:1px solid #999; border-radius: 3px; padding: 10px; box-sizing:border-box; } #editable:focus { outline: none; } <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script> <div contenteditable="true" id="editable"></div>

objective c - My ios app is not running in iOS7 -

i have used autolayout in storyboard , working fine in ios7 before week. have altered constraints before 2 days after app not running in ios7. getting following warning in storyboard. "automatic preferred max layout width not available on ios versions prior 8.0" in xcode console window getting following error, "terminating app due uncaught exception 'nsinvalidargumentexception', reason: 'unable create description in descriptionforlayoutattribute_layoutitem_coefficient. nil'" could please me find solution. thanks in advance

Django, socket.io, node.js - Manage private messages and group conversations -

i in process of writing back-end service such facebook messenger or whatsapp. i started out following splendid tutorial . i api written in python (django) . along side api, have redis process , node.js server running (localhost only). node.js server uses socket.io library real-time communication through websockets an http-request containing message can sent client django api, in turn publishes message redis on channel. the node.js server has subscribed redis channel, , gets notified when such message published. node keeps track of sockets connected array of socket ids keyed user identifier. i have few questions this: 1. private messages i send message targeted user. initial approach have http-request (sent django) include user message should reach. when message reaches node.js server (through redis), node can find user in array of clients. django obviously(?) needs know socket.io socket belongs user. i.e. django needs know user identifying key node should use gr

c# - How to display data from a specific week? -

i want display data specific week giving date e.g. 2015-06-01 this table want use week bookingid checkindate checkoutdate 1 2015-05-25 2015-05-31 2 2015-05-26 2015-06-03 3 2015-06-01 2015-06-07 4 2015-06-01 2015-06-12 here database manager code data week: public static arraylist getstatsbyweek(int week, int year) { sqlconnection conn = new sqlconnection(); sqlcommand comm = new sqlcommand(); arraylist rmcount = new arraylist(); try { conn.connectionstring = gsm_conn_str; conn.open(); comm.connection = conn; comm.commandtext = "select count(bookingid) \"totalcount\" checkinout datepart(week,checkindate)=@week or datepart(week,checkoutdate)=@week , year(checkindate)=@year , year(checkoutdate)=@year"; comm.parameters.addwithvalue("@week", week); comm.parameters.addwithvalue("@year&qu

javascript - How do I keep my ul element from disappearing when it is clicked? -

<!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>javascript events</title <style> ul { margin:0px auto; width:700px; height:600px; position:relative; cursor:pointer; border:black;*/ } li { width:200px; height:200px; background:black; display:inline-block; } #red { background:red; } #green{ background:green; } #blue { background:blue; } #orange{ background:orange; } #purple{ background:purple; } #pink { background:pink; } #silver { background:silver; } #gold{ background:gold; } #black { background:black; } </style> </head> <body> <ul id="grid"> <li alt="red1" class="red" id='red' ></li> <a href="http://www.google.com"><li id="orange"></li></a> <li id="silver"></li> <li alt="green machine" id="green"></li> <li id="gol

objective c - xCode 6.3.2 Crash [UIViewController .cxx_destruct] -

i have converted application written in objective-c, using sql, changed coredata. issue identify far when changed nsobject nsmanagedobject in 1 of class getting stupid crash in viewcontroller after view dismissed: [self dismissviewcontrolleranimated:yes completion:nil]; control stopped @ @implementation viewcontroller , if changed model being used in class nsobject there no crash, view dismissed properly. i have found nothing far crash crash means? is there way debug this? i have faced similar issue, added below code dealloc solved issue. -(void) dealloc { [_managedobjectcontext reset]; } or -(void) dealloc { _objectfromcontext = nil; _managedobjectcontext = nil; } for more details refer link hope helps you.

validation - Django Rest Framework - how to create custom error messages for all ModelSerializer fields? -

this serializers.py (i want create serializer built-in user model): from rest_framework import serializers django.contrib.auth.models import user class userserializer(serializers.modelserializer): class meta: model = user fields = ('username', 'password', 'email', ) i'm aware django rest framework has it's own field validators, because when try create user using username exists, raises error saying: {'username': [u'this field must unique.']} i want customize error message , make "this username taken. please try again" rather saying "this field must unique". it has built-in regex validator, because when create username exclamation mark, says: {'username': [u'enter valid username. value may contain letters, numbers , @/./+/-/_ characters.']} i want customize regex validator says "invalid username". how customize of error messages each field has? note:

html - table width not adaptive in IE -

table not displaying full-width in ie explorer. how make table's width not depend on column width, e.g., 100px*3, depend on window width? css code: table { border-collapse: collapse; border-spacing: 0; background-color: transparent; width: 100%; table-layout: fixed; } html code: <table class="table table-hover table-bordered"> <thead> <tr> <th style="width: 100px;">xxx</th> <th style="width: 100px;">xxx</th> <th style="width: 100px;">xxx</th> </tr> </thead> <tbody> <tr> <td></td> <td></td> <td></td> </tr> <tbody> </table> notice problem doesn't exist in chrome or firefox. try put wi

javascript - jQuery/Mapbox multiple data filters issue -

i have map, built in mapbox, feeds off of geojson. i'm trying filter markers 2 criteria: category (multiple true/false properties) , year. want 2 filters work @ same time, not cancel each other out, i'm getting stuck when combining them. each filter works independently — have year: $('.year a').on("click", function() { var year = $(this).data('filter'); $(this).addclass('active').siblings().removeclass('active'); featurelayer.setfilter(function(f) { return (year === 'all' || f.properties.year === year); }); return false; }); and have category: $('.category a').on("click", function() { var category = $(this).data('filter'); $(this).addclass('active').siblings().removeclass('active'); featurelayer.setfilter(function(f) { return ((category === 'all') ? true : f.properties[category] === true); }); return false; });

java - Sort an array of zeros, ones and twos -

i trying sort arrays in such way such zeros should come first , followed ones , followed twos. input: { 0, 1, 2, 1, 2, 2, 0, 0, 1 }; output: { 0, 0, 0, 1, 1, 1, 2, 2, 2 }; below program doesn't work on above input: public class seggregatezeroonetwos { public static void main(string[] args) { int[] = { 0, 1, 2, 1, 2, 2, 0, 0, 1 }; arrangenumbers(a); system.out.println(arrays.tostring(a)); } public static void arrangenumbers(int[] arr) { int low = 0; int high = arr.length - 1; int = 0; while (i < high) { if (arr[i] < 1) { swap(arr, i, low); low++; i++; } else if (arr[i] > 1) { swap(arr, i, high); high--; } else { i++; } } } public static void swap(int[] arr, int i, int j) { arr[i] = arr[i] ^ arr[j]; arr[j] = arr[

appendChild method in a simple carousel with pure JavaScript -

i trying make simple javascript carousel scratch. js fiddle css #wrapper{ position: relative; width: 450px; height: 150px; margin: 0 auto; overflow: hidden; } #container{ position: absolute; width: 450px; height: 150px; } .child{ width: 150px; height: 150px; padding-top: 35px; float: left; text-align: center; font-size: 60px; } #a{ background: #ff0000; } #b{ background: #ffff00; } #c{ background: #00ffff; } html <div id="wrapper"> <div id="container"> <div id="a" class="child">a</div> <div id="b" class="child">b</div> <div id="c" class="child">c</div> </div> </div> js var firstval = 0; function carousel(){ firstval += 2; parent = document.getelementbyid( 'container' ); parent.style.left = "-" + firstval + "px&

javascript - Loop updating classes instead of id fields -

i'm trying make function can applied multiple instances of class within page refresh data via ajax call. function works fine 1 instance on page: $(document).ready(function() { function getdata(t, id, table, hid) { var autoload = setinterval(function (){ $(t).load('ajax.php?id='+id+'&table='+table).html(hid); } , 5000); } var elements = document.getelementsbyclassname("refresh"); (var = 0, item; item = elements[i]; i++){ var tableid = $(item).attr('id'); var rid = $(item).data('id'); var rtable = $(item).data('table'); getdata('.refresh', rid, rtable, tableid); console.log(rid + rtable + tableid); } }); the rtable , rid serve determine data pulled ajax w/ php script. in 1 iteration, i'm calling script on table: <tbody id="files" class="refresh" data-id="10" data-table="files-refre

How to remove element from list in Redis by value? -

how remove element list in redis value? for exmaple, have: 127.0.0.1:6379> lrange post:544 0 -1 1) "1" 2) "2" 3) "36" 127.0.0.1:6379> i know value 36 , not index. can remove element list value? http://redis.io/commands/lrem lrem looking for. use lrem post:544 1 36.

assembly - xmm, cmp two 32-bit float -

i'm trying understand how compare 2 floating point numbers (32-bit) using xmm registers. test i've written code in c (which calls code in assembly): #include "stdio.h" extern int compare(); int main() { printf("result: %d\n", compare()); return 0; } here assembly, want test if b < c, in case , code should return 1, returns 0: section .data a: dd 5.5555 b: dd 1.1111 c: dd 5.5555 section .text global compare compare: ; ------------------------------------------- ; entrace sequence ; ------------------------------------------- push ebp ; save base pointer mov ebp, esp ; point current stack frame push ebx ; save general registers push ecx push edx push esi push edi movss xmm0, [b] movss xmm1, [c] comiss xmm0, xmm1

c# - how to get all tweets on hashtag using Tweetsharp -

how can tweets on behalf of specific hashtag/keyword , display on view page? solution found returns null exception. public actionresult tweetview(string txttwittername) { //twitterservice("consumer key", "consumer secret"); var service = new twitterservice("", ""); //authenticatewith("access token", "accesstokensecret"); service.authenticatewith("", ""); twittersearchresult tweets = service.search(new searchoptions { q = txttwittername, sinceid=29999 }); ienumerable<twitterstatus> status = tweets.statuses; viewbag.tweets = tweets; return view(); } view : ienumerable<twitterstatus> tweets = viewbag.tweets ienumerable<twitterstatus>; foreach (var tweet in tweets) { <div class="tweet"> <div class="picture"> <img src="@tweet.user.profileimageurl" alt="@tweet.user.screenname&qu

C++ sapi: User input, edit voice out -

#include <sapi.h> #include <string> #include <iostream> //user inputs said// int main(int argc, char* argv[]) { ispvoice * pvoice = null; if (failed(::coinitialize(null))) return false; hresult hr = cocreateinstance(clsid_spvoice, null, clsctx_all, iid_ispvoice, (void **)&pvoice); if (succeeded(hr)) { std::wstring input; while (true) { std::cout << "enter text:\n"; std::getline(std::wcin, input); hr = pvoice->speak(input.c_str(), 0, null); } } pvoice->release(); pvoice = null; ::couninitialize(); return 0; } the code above allows user input want have spoken , works perfectly. below msdn method of changing pitch , other similar action done same way. hr = pvoice->speak(l"this sounds normal <pitch middle = '-10'/> pitch drops half way through", spf_is_xml, null ); i want change pitch, can&

matlab - Polyfit for more than one variable? -

does exists function similar polyfit interpolate n variables? polyfit use x, y, n, n degree, instead use x, y, z, , n. idea? to best of knowledge, there isn't direct function can use in matlab. however, can solve problem manually using fitlm .

jquery - Strange JavaScript Loop Happening with Three.Js -

i building prototype spa angular , three.js learn both technologies. have few angular templates selectable via nav, , show different 3d elements rotating. the cube element exhibiting strange behaviour; when navigate tab , navigate back, rotation speed increased. not happening other 3d elements, , can't figure out why. here link project . // cube rotation values var cuberotationx = .005; var cuberotationy = .005; // cube size value var cubesize = 1; // load cube var geometry = new three.boxgeometry( cubesize, cubesize, cubesize ); var material = new three.meshphongmaterial ( { color: 0xededed, } ); var cube = new three.mesh( geometry, material ); // cube change size function function changecubesize() { cubesize = document.getelementbyid('size-selector').value; } // cube toggle function function togglecuberotation() { if (cuberotationx > 0) { cuberotationx = 0; cuberotationy = 0; } else { cuberotationx = 0.005; cub

c# - Why I cannot use the using statement with my static method? -

this question has answer here: returning sqldatareader 5 answers if use in class works properly, when call default.cs: public class mymethodssql { public static sqldatareader metodocommand() { string cs = configurationmanager.connectionstrings["dbcs"].connectionstring; sqlconnection con = new sqlconnection(cs); sqlcommand cmd = new sqlcommand(); cmd.commandtext = "select * employees"; con.open(); cmd.connection = con; sqldatareader sdr = cmd.executereader(); return sdr; } } protected void button1_click(object sender, eventargs e) { gridview1.datasource = mymethodssql.metodocommand(); gridview1.databind(); } but when use using statement error: says there no open connections public class mymethodssql { public static sqldatareade

SignalR, ASP.NET 5 and CORS -

i'm trying use signalr mvc6 application, encounter problem cors. first : if host index.html file on http://localhost:1234/index.html (same web app) it's working. when host elsewhere (for example in file:///c:/users/me/documents/index.html), have error : no 'access-control-allow-origin' header present on requested resource. origin 'null' therefore not allowed access. of course, try enable cors, startup file : public class startup { public void configureservices(iservicecollection services) { services.addmvc(); services.addsignalr(); services.addcors(); var policy = new microsoft.aspnet.cors.core.corspolicy(); policy.origins.add("*"); policy.headers.add("*"); policy.methods.add("*"); services.configurecors(x => x.addpolicy("allowall", policy)); } public void configure(iapplicationbuilder app) { app.usecors(&quo

Set a Top Level or Super Duper Global Variable in PHP? -

is possible make top level variable in php? defining in .htaccess or httpd.conf ? included in each .php file? i love define basepaths , other variables there if possible. making init.php , including 'em on top if each file. as working multi entry point application, if want avoid including configuration file, can use php's autoprepend functionality . automatically include file without need <?php require('init.php'); ?> in each of entry points. and can find good advice here .

javascript - Getting search field to filter results in Angular, problems Gulp / ng-model -

problem i have input field want readers able search businesses, have been put onto page using angular's ng-repeat. right now, when type search field, doesn't filter of them. where problem be wondering if it's problem gulpfile.js , how it's compiling build folder. other possibilities include incorrect using of directive ng-model or if ng-controller="mainctrl" in wrong place? currently i'm using foundation apps, include angular views , routing. i've included link github , code samples below. edit #1: putting ng-controller="mainctrl" in header not seem work, instead businesses not show when compiled. github: https://github.com/onlyandrewn/angular gulpfile.js // foundation apps template gulpfile // ------------------------------------- // file processes of assets in "client" folder, combines them foundation apps assets, , outputs finished files in "build" folder finished app. // 1. libraries // - - -

currency - Swift NSNumberFormatter CurrencyStyle Without Symbol -

this question has been answered in objective-c here . how can in swift? import uikit let nf = nsnumberformatter() nf.currencysymbol = "" nf.numberstyle = .currencystyle let stringfromnumber = nf.stringfromnumber(100) // "100.00"

ios - Socket programming python on real server -

Image
i'm following http://www.raywenderlich.com/3932 socket programming in ios server coding in python , however, want know according tutorial, author used localhost , run code terminal such python server.py execute , listen socket. what i'm confusing that, how can make command on real server, such after putting code of python in cgi-bin , how can run shell/terminal of shared web hosting. here's ssh screenshot, tried run command bind , listen socket, here i'm failed no java login section appearing in case video tutorial shows. my question is, how can run command server listen port, on localhost. the command is: python server.py on shared web hosting server have running web server write scripts generate output web server return client. server.py no such script. contains code actual server. running command starts server. therefore won't working putting file in cgi-bin folder. need run command.

php - How to use the array intersect method to match two values within 2 sets of arrays -

i have query: $subcommon= mymodel::selectraw('subjectlist_id, count(subjectlist_id) aggregate') ->wherein('user_id', [auth::id(), $user->id]) ->groupby('subjectlist_id') ->having('aggregate','>',1) ->get(); which gives query result: {"subjectlist_id":1,"aggregate":2} {"subjectlist_id":3,"aggregate":2} i have query: $values = mysecondmodel::where('user_id', auth::id()) ->first(); which gives result: {"id":1,"subjectlist_id":1, "article_id":4} because im finding way difficult join these 2 models i've decided output them arrays @ least 1 matching value subjectlist_id condition execute query i've displayed @ bottom. i'm assuming it's arrayintersect method im unsure how use it. $values = mysecondmodel::where('user_id', auth::id()) ->first(); i ha

c# - WPF Bind ListBoxItem to DataGrid -

i need bind listboxitem , datagrid in following way: user doubleclicks on listboxitem , sql query performed , retrieved data shown on datagrid. here's have: <datagrid x:name="gridstatistics" margin="0,144,0,0" /> <listbox x:name="lststat" horizontalalignment="left" height="129" margin="10,10,0,0" verticalalignment="top" width="330" fontsize="16" itemssource="{binding statisticsqueries}" cursor="arrow" previewmouserightbuttondown="lststat_previewmouserightbuttondown" previewmouserightbuttonup="lststat_previewmouserightbuttonup" mousedoubleclick="lststat_mousedoubleclick"> <listbox.itemtemplate> <datatemplate> <label content="{binding path=name}" fontweight="medium" fontsize="18" fontfamily="helveticaneuecyr"/>

null - Global assignment within a reactive expression in R Shiny? -

suppose have data object uploaded user: data <- reactive({ infile <- input$file if (is.null(infile)) return(null) data <- read.csv(infile$datapath) return(data) }) and suppose want delete columns in dataset. want set global assignment can run ui multiple times , have each effect saved in object. dataset <- reactive({ file1 <- data() file1[,input$deletecols] <<- null return(file1) }} }) however, when run this, error: invalid (null) left side of assignment what's causing error? , how can achieve effect if global assignment doesn't work? thanks much. you should use reactivevalues() kind of need, because allows create , modify data @ different stages in app. here example (not tested): values <- reactivevalues() observe({ infile <- input$file if (!(is.null(infile))){ values$data <- read.csv(infile$datapath) } }) observe({ values$data[,input$deletecols] <- null }

graphics - Common lisp typecase vs defgeneric runtime analysis -

i'm writing app common lisp uses opengl, , thing has grown i've realized have bit of choice make. have bunch of different classes need code render them , often, i'm considering following code structures doing this: (defgeneric render (x)) (defmethod render ((x vanilla-foo)) (generic-foo-stuff) (vanilla-specific-stuff) (more-generic-foo-stuff)) (defmethod render ((x chocolate-foo)) (generic-foo-stuff) (chocolate-specific-stuff) (more-generic-foo-stuff)) and on, lots of these methods. other alternative use typecase statement: (defun render (any-old-foo) (generic-foo-stuff) (typecase (vanilla-foo (vanilla-specific-stuff)) (chocolate-foo (chocolate-specific-stuff)) ;;and on, lots of cases here ) (more-generic-foo-stuff)) i suppose these both ugly in own way, assumption lisp using kind of hash table o(1) lookup under hood maps argument type passed generic function location of needed method, whereas