Posts

Showing posts from February, 2015

Red dots in typescript source file in Google Chrome Dev Tools -

Image
i want debug typescript file in google chrome, reason see weird red dots. see image. has encountered that? i've tried change encoding of file utf-8 did not help. how fix it? it happens in chrome (both standard , canary versions). ie , firefox behaves ok the file appears have been encoded using utf-16 being interpreted utf-8. each of red dots represents null byte supposed part of two-byte character in utf-16 own character in utf-8.

Wordpress custom post order -

i trying order each post in category custom field (using advanced custom fields plugin) $the_query = new wp_query(array( 'posts_per_page' => -1, 'meta_key' => 'adult_price', 'orderby'=> 'meta_value_num', 'order' => 'asc' )); if ( $the_query->have_posts() ) : while ( $the_query->have_posts() ) : $the_query->the_post(); get_template_part( 'template-parts/content', get_post_format() ); endwhile; endif; the problem it's somehow returning posts all other categories. try code. $args = array( 'orderby' => 'meta_value', 'meta_query' => array(array('key' => 'adult_price')), 'order' => 'asc', 'paged'=>$paged, );

angularjs - How to mock $scope.variables in jasmine -

i have following test case companyctrlspec.js describe('viewcompanyctrl', function () { var $rootscope, scope, $controller , $q ; beforeeach(angular.mock.module('myapp')); beforeeach(inject(function ($rootscope, $controller ) { scope = $rootscope.$new(); createcontroller = function() { return $controller('viewcompanyctrl', { $scope: scope, company : {} }); }; })); it('the company type should equal object', function () { var controller = new createcontroller(); //some assertion }); }); following viewcompanyctrl.js file angular.module('myapp').controller('viewcompanyctrl', function ($scope, companyservice, $state, meetingservice, company, attachmentservice) { 'use strict'; $scope.company = company; $scope.companyinfo = {}; $scope.companyinfo['aname'] = [$scope.c

c++ - How I get the cdata out in c function with variable arguments using luajit? -

here code. aim print messages. in printc, e...but arrives cdata. how can unpack or circumvent that? extern "c" { static int printc ( lua_state *l ) { // not work cdata //executor* e = ( executor* ) lual_checkudata(l, 1, "cdata"); n //lual_checkudata(l, 1, "void *"); if ( e->writelog ) { int no = lua_gettop ( l ) ; ( int = 2; <= no; i++ ) { cout << lua_tostring (l,i); } } return 1; } } // initialised lua_pushcfunction ( l, printc ); lua_setglobal ( l, "printc" ); lua_pushinteger ( l, ( long ) ); // in class executor lua_setglobal ( l, "p" ); p= ffi.cast("void *",p) function print() return printc(p) end you can't. lua c api , luajit ffi deliberately separated , cannot interact. rewrite printc in lua using ffi, or write lua c api bindings

c# - Declare callback event handlers correctly -

i have simple delegate, event , property allowing me create callback subscriptions on events: public static class test { /// <summary>delegate property changed event</summary> public delegate void testeventhandler(); /// <summary>event called when value changed</summary> public static event testeventhandler ontesthappening; /// <summary>property specify our test happening</summary> private static bool testhappening; public static bool testhappening { { return testhappening; } set { testhappening = value; // notify our value has changed if true // ie. fire event when we're ready we'll hook methods event must fire if ready if ( value ) { if ( ontesthappening != null ) ontesthappening(); } } } } i can subscribe , unsubscribe event , f

c# - OAuth 2.0 and OpenID Connect libraries -

what best options oauth 2.0 , openid connect open source libraries c# (.net) implementation. i know few, either oauth 2.0 or other not both the openid foundation keeps list of libraries/products here: http://openid.net/developers/libraries/ identityserver3 implements both oauth 2.0 , openid connect in c#.

php - SQL queries in Redbeanphp -

i trying execute following code using redbeansphp(works on top of php pdo). issue when pass valid id in format - "id;drop table users;" , if id matches id in database result returned. although sql injection doesnt work. tried other methods of injection well. none of them works. why result though id incorrect. 1 more thing that if add code in front of id results don't come. ? $article = r::getall( 'select avg(rating) reviews id =?', array($id)); //throwing exception if query unsuccesful if(!$article){ throw new exception(); } //response message $arr=array('status' => 'successful', 'message' => 'reviews found','reviews'=> $article ); $app->response()->header('content-type', 'application/json'); $msg=json_encode($arr); $app->response->body($msg ); after lot of research , going through redbeans fil

How to set page size in GridView in yii2 -

i want set item per page in gridview in view file in yii2 project. know can set in dataprovider instance, want set in each view file separately. how can it? i hope public function actionindex() { $searchmodel = new contribuentesearch(); $dataprovider = $searchmodel->search(yii::$app->request->queryparams); $dataprovider->pagination->pagesize=15; return $this->render('index', [ 'searchmodel' => $searchmodel, 'dataprovider' => $dataprovider, ]); }

php - multiple tables in 1 query -

i have 2 tables in database: bogie table: +----------+----------+---------+----------+ | bogie_id | train_id | axle_nr | bogie_nr | +----------+----------+---------+----------+ | 1 | 1 | 1 | 1 | | 2 | 1 | 2 | 1 | | 3 | 1 | 3 | 2 | | 4 | 1 | 4 | 2 | +----------+----------+---------+----------+ axle table: +---------+----------+------+----------+ | axle_id | train_id | axle | distance | +---------+----------+------+----------+ | 1 | 1 | 1 | 2500 | | 2 | 1 | 2 | 5000 | | 3 | 1 | 3 | 2500 | +---------+----------+------+----------+ now, want show axles bogie table (4) , distances axle table (3) i made query (don't mind names): function hopethisworks(){ $sql = "select * axle train_id = :train_id"; $sth = $this->pdo->prepare($sql); $sth->bindparam(':train_id

python - Validation causing error -

when running following function: def restoreselection(self, selecteditems): self.recvlist.selection_clear(0,"end") items = self.recvlist.get(0,"end") item in selecteditems: _i in items: if item[:6] == _i[:6]: index = items.index(item) print index self.recvlist.selection_set(index) i error: exception in tkinter callback traceback (most recent call last): file "/usr/lib/python2.7/lib-tk/tkinter.py", line 1437, in __call__ return self.func(*args) file "/usr/lib/python2.7/lib-tk/tkinter.py", line 498, in callit func(*args) file "./pycan1.8.py", line 710, in recvbtn_click self.restoreselection(selected) file "./pycan1.8.py", line 443, in restoreselection index = items.index(item) valueerror: tuple.index(x): x not in tuple unfortunately error message isn't terribly clear. please explain error message is? , causing function produc

jmh - Benchmark results ForkJoin vs Disruptor? -

Image
i have run disruptovsfj mirco-benchmarks written aleskey shipilev , forkjoin , disruptor library performance compared. the results have using jdk1.8.40 on linux platform i5: benchmark score, score error (99.9%),unit,param: slicesk, disruptor.run, 939.801405, 20.741961,ms/op, 50000,0,10 forkjoin.run, 1175.263451, 0.595711, ms/op, 50000,0,10 forkjoinrecursive.run 771.854028, 26.022542,ms/op, 50000,0,10 forkjoinrecursivedeep.run, 1356.697011, 28.666325,ms/op, 50000,0,10 forkjoinreuse.run, 7974.180793, 49.604539,ms/op, 50000,0,10 the first part of results slicesk < 50000 expected disruptor using ringbuffer , mechanism makes efficient in concurrent context. now when slicesk >= 50000 disruptor test less performant forkjoinrecursivedeep, , forkjoinreuse. can explain me results ? thank you answer : your disruptor usable ring buffer somehow full @ slicesk >= 50000 cause per

java - First app in android studio, R class -

i've install android studio learning developing apps in android. i've installed newest java , android studio in first generated hello world project, have many issues r class. android version rendering 5.1.1. when click on activity_main.xml , don't have smartphone illustration design. there following error: note: project contains java compilation errors, can cause rendering failures custom views. fix compilation problems first. following classes not instantiated: - android.support.v7.internal.widget.actionbaroverlaylayout (open class, show exception, clear cache) tip: use view.isineditmode() in custom views skip code or show sample data when shown in ide exception details java.lang.noclassdeffounderror: not initialize class android.support.v7.internal.widget.actionbaroverlaylayout   at java.lang.reflect.constructor.newinstance(constructor.java:422)   at android.view.layoutinflater.inflate(layoutinflater.java:482)   at android.view.layoutinflater.inflate(layou

php - Laravel Create OR update related model -

i have following function create new related model; //create results entry $result = new result([ 'result' => $total, 'user_id' => $user->id, ]); //attach fixture - parse through looking user_id or opponent_id //to match current user in loop. $fixture = leaguefixture::where('league_id', $league_id) ->where('gameweek', $gameweek) ->where(function($q) use ($user){ $q->where('user_id', $user->id) ->orwhere('opponent_id', $user->id); }) ->first(); $fixture->results()->save($result); the ->save() @ end of magic, attaching correct fixture_id result table. problem if func

javascript - Sum by category in Piechart (Dc.js & Crossfilter) -

i try use dc.js , crossfilter have problem adding values having same category. i explain : have demo 3 columns (project, amount, action). create amount categories code: var amount = d.amount; if (amount<=10) { return '< 10'; } else if (amount >10 && amount < 50) { return '<50'; } else if (amount >= 50 && amount <= 80) { return '< 80'; } else { return '> 80'; } all want : if it's same project, add amount , create these categories. so in < 10 category there redaction . in >10 , <50 category there'll design , website hosting ... , if >50 there'll website design . here jsfiddle : http://jsfiddle.net/nicart/179n4bfg/6/ thank help, i'm totally lost. so want dynamically calculate category? example, if "design" project had "stuff" action value of 5, , f

Timeout exception when trying to download any remote index in Archiva 2.2.0 -

Image
archiva 2.2.0. , running on vm (centos 6.6). vm can access internet behind proxy. for example, get repo1.maven.org works well: ... <body> <div id="top"></div> <div id="container"> <p>browsing directory has been disabled.</p> <p><a href="http://search.maven.org/#browse">view</a> directory's contents on <a href="http://search.maven.org/#browse">http://search.maven.org</a> instead.</p> <p>find out more <a href="http://central.sonatype.org">the central repository</a>.</p> <div id="footer-spacer"></div> </div> <div id="footer"> <a href="http://central.sonatype.org">about central</a>&nbsp;|&nbsp;<a href="/terms.html">terms of service</a> </div> </body> ... two

python - Does setUp method from unittest.TestCase know the current test case? -

does setup method unittest.testcase knows next test case executed? example: import unittest class tests(unittest.testcase): def setup(self): print "the next test be: " + self.next_test_name() def test_01(self): pass def test_02(self): pass if __name__ == '__main__': unittest.main() such code should produce upon execution: the next test be: test_01 next test be: test_02 no, unittest makes no guarantee order of test execution. moreover, should structure unit tests not rely on particular order. if require state setup test method no longer have, definition, unit test. the current test method name executed lives in self._testmethodname , use @ own risk (accessing _private attributes subject breakage without warning). not use customise setup based on particular test method, prefer split tests requiring different setup off separate test classes.

javascript - Adding ngInit to all the elements with specified css class -

i have single page application (angularjs + angular-ui-router) , there many elements 'somecssclass'. i need add global handler (at window object), handles these elements init event. there way this, except manually adding nginit (or this) each element in each view? i end directive , link option. app.directive('somecssclass', function () { return { restrict: 'c', link: function inithandler(scope, element, attrs){} }; });

Unit Test Case for Private Methods and Properties using FakeItEasy -

this question has answer here: how unit test private methods? 31 answers how test private methods , properties using fakeiteasy frame work fakeiteasy has no knowledge of production class's private methods , properties, , cannot used test them directly. as @samholder points out, such practice bad idea, private methods implementation details.

joomla3.0 - How to break page title in Joomla? -

i want break page title of joomla 3 website 2 lines. can admin add <br> tag between page title field in end? e.g. 'home[br]page' override following constant jpagetitle , give value %1$s <br> %2$s in extension > language manager > overrides

Javascript Jquery slideshow -

what code in jquery let in slideshow make first photo appear after clicking next when on last photo. know need write once document ready didnt yet will. here code <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script> <script src="slides.min.jquery.js"></script> <script type="text/javascript" src="http://code.jquery.com/jquery-1.7.1.js"></script> <script type="text/javascript" src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script> <script> $(document).ready(function() { $("#links").mouseover(function() { $("#links").animate({ 'opacity': '1' }); }); }); $(document).ready(function() {

c - Function pointers and necessity -

this question has answer here: what point of function pointers? 15 answers i interested in cracking minute things in c. function pointer: from know, function pointer nothing more c variable points address of function normal c variable. can call function using pointer also. questions: what necessity of using function pointers rather using functions alone? will advanced thing normal function cannot do? according wikipedia, “in computer programming, callback reference executable code, or piece of executable code, passed argument other code. allows lower-level software layer call subroutine (or function) defined in higher-level layer.” in c callbacks implemented using function pointers. example, see link. can normal function take function 1 of arguments ? callback advanced thing in sense , function pointers implement them. further, use case ex

python - printing a dictionary with specific format -

i done project , want print results. have dictionary this: {('a',): 4, ('b',): 5, ('c', 'd'): 3, ('e', 'f'): 4, ('g', 'h'): 3, ('i',): 3} the key in pair key-value 1 element , in others 2 or three. , want print in format, elements 1 key in 1 line, elements 2 keys in new line etc... (elem,) (elem1, elem2, ..., elem_n) i tried this: itemdct //my dict result = [itemdct] csv_writer = csv.writer(sys.stdout, delimiter=';') row = [] itemdct in result: key in sorted(itemdct.keys()): row.append("{0}:{1}".format(key, itemdct[key])) csv_writer.writerow(row) but output in 1 line. ('a',):3;('b',):4;('c', 'd'):3;('e', 'f'):3;...... mydict this {('a',): 3, ('b', 'c'): 3, ....} and result this [{('a',): 3, ('b', 'c'): 3,.....}] thank in advance.. edit: want output this: ('a

asp.net mvc - undifined error of $scope variable in angularjs -

i developing ecommerce website asp.net mvc angularjs. getting issue $scope in 1 of page.i define $scope.items array in controller , trying fetch values in array cookies. here code app.controller('checkoutcontroller', ['$scope', 'productservice', '$cookies', '$cookiestore', '$location', 'sharedservice', '$rootscope', 'customerservice', function ($scope, productservice, $cookies, $cookiestore, $location, sharedservice, $rootscope, customerservice) { $scope.items = []; $scope.customer = {}; $scope.customer.firstname = ""; $scope.customer.lastname = ""; $scope.customer.email = ""; $scope.customer.password = ""; $scope.customer.cpassword = ""; $scope.customer.address1 = ""; $scope.customer.address2 = ""; $scope.customer.zipcode = ""; $scope.customer.country = ""; $scope.custome

how to use PHPMyGraph5.0 to mysql php -

help please, have been searching months now. cant seem use phpmygraph5.0 mysql php. here's code. //set content-type header header("content-type: image/png"); //include phpmygraph5.0.php include_once('phpmygraph5.0.php'); include('includes/dbconnect.php'); //set config directives $cfg['title'] = 'example graph'; $cfg['width'] = 400; $cfg['height'] = 200; //set data $query="select extract(month `table`.`datetime`) `date`, count(distinct `table`.`id`) `count` `table` `table`.`datetime` between '2015-01-01' , '2015-12-31' group `date` order `date`"; $result = mysql_query($query) or die('query failed: ' . mysql_error()); if ($result) { $data=array( while ($row = mysql_fetch_assoc($result)) { $month=$row["date"]; $count=$row["count"]; //add data areray $dataarray[$month]=$count;

ios - UIWebView Copy Cache Data For Offline View -

i want copy cache data database(sqlite/coredata) can view while offline (without internet) " reading list in safari ". read code @ xcode uiwebview download , save html file , show following:- - (void)viewdidload { nsurl *url = [nsurl urlwithstring:@"http://livedemo00.template-help.com/wt_37587/index.html"]; //[webview loadrequest:requrl]; // determile cache file path nsarray *paths = nssearchpathfordirectoriesindomains(nsdocumentdirectory, nsuserdomainmask, yes); nsstring *filepath = [nsstring stringwithformat:@"%@/%@", [paths objectatindex:0],@"index.html"]; // download , write file nsdata *urldata = [nsdata datawithcontentsofurl:url]; [urldata writetofile:filepath atomically:yes]; // load file in uiwebview [webview loadrequest:[nsurlrequest requestwithurl:[nsurl fileurlwithpath:filepath]]]; [super viewdidload]; } but problem code not show images while offline . so thoug

c# - How do i make instance for array of ToolStripMenuItem items? -

in top of form1: toolstripmenuitem[] items; in constructor: for (int = 0; < items.length; i++) { items[i] = new toolstripmenuitem(); recentfilestoolstripmenuitem.dropdownitems.addrange(items); } if (!file.exists(@"e:\recentfiles.txt")) { recentfiles = new streamwriter(@"e:\recentfiles.txt"); recentfiles.close(); } else { lines = file.readalllines(@"e:\recentfiles.txt"); } before used single item , made 1 instance in top of form1. want add dropdownitems array of items. , don't how many items want unlimited. then have event: private void recentfilestoolstripmenuitem_mouseenter(object sender, eventargs e) { (int = 0; < lines.length; i++) { items[i].text = lines[i]; } } when used single item did in mouseenter event: item.text = "hello world"; but want add items text file can 1 items or 200 items problem items null in constructor. i did in constructor changed to:

c++ - Why isn't sizeof for a struct equal to the sum of sizeof of each member? -

why 'sizeof' operator return size larger structure total sizes of structure's members? this because of padding added satisfy alignment constraints. data structure alignment impacts both performance , correctness of programs: mis-aligned access might hard error (often sigbus ). mis-aligned access might soft error. either corrected in hardware, modest performance-degradation. or corrected emulation in software, severe performance-degradation. in addition, atomicity , other concurrency-guarantees might broken, leading subtle errors. here's example using typical settings x86 processor (all used 32 , 64 bit modes): struct x { short s; /* 2 bytes */ /* 2 padding bytes */ int i; /* 4 bytes */ char c; /* 1 byte */ /* 3 padding bytes */ }; struct y { int i; /* 4 bytes */ char c; /* 1 byte */ /* 1 padding byte */ short s; /* 2 bytes */ }; struct z { int i; /* 4 bytes */ sh

java - JFace dialog with tabs -

i want implement tabbed dialog using jface in eclipse rce application. content of 1 of tabs should containerselectiondialog , content looks following: containerselectiondialog dialog = new containerselectiondialog( display.getdefault().getactiveshell(), container, true, "please select target folder"); int open = dialog.open(); if (!(open == org.eclipse.jface.window.window.ok)) return null; object[] result = dialog.getresult(); ipath path = (ipath) result[0]; targetfolder = resourcesplugin.getworkspace().getroot().findmember(path); containerpath = targetfolder.getlocation().toportablestring(); how possible imlement tabbed dialog , add containerselectiondialog 1 of tabs? you cannot that. said, selectioncontainerdialog is dialog. can't put content dialog. take @ selectioncontainerdialog class, main content handled class named selectioncontainergroup . may place start but,be careful class, it's internal .

rjava - p-value calculation using Java -

i want make java program calculate p-value of data want upload, getting trouble so. data been read java program, next step solve data getting p-value. the input file is: the input should be:- name a b c a 1.7085586 0.73179674 3.3962722 b 0.092749596 -0.10030079 -0.47453594 c 1.1727467 0.15784931 0.0572958 d -0.91714764 -0.62808895 -0.6190882 e 0.34570503 0.10605621 0.30304766 f 2.333506 -0.2063818 0.4022169 g 0.7893815 1.449388 1.5907407 , output should this:- name pvalue a 0.129618298 b 0.4363544 c 0.323631285 d 0.017916658 e 0.076331828 f 0.385619995 g 0.035449488 i have run data in r program want write java solve this. my java code till is: import java.io.bufferedreader; import java.io.filereader; import java.io.ioexception; public class abc { public static void main(string[] args) { // todo auto-generated method stub bufferedreader br = null; try { string scurrentline; br = new bufferedrea

c - Fast algorithm mapping int to monotonically increasing int subset -

i have encountered variations of problem multiple times, , became bottleneck in arithmetic coder implementation. given n (<= 256) segments of known non-negative size s i laid out in order starting origin, , given x, want find n such s 0 + s 1 + ... + s n-1 <= x < s 0 + s 1 + ... + s n the catch lookups , updates done @ same frequency, , every update in form of increasing size of segment 1. also, bigger segment, higher probability looked or updated again. obviously sort of tree seems obvious approach, have been unable come tree implementation satisfactorily takes advantage of known domain specific details. given relatively small size of n, tried linear approaches, turned out considerably slower naive binary tree (even after optimization, starting of list numbers above half total) similarly, tested introducing intermediate step remaps values in such way keep segments ordered size, make access faster used, added overhead exceeded gains. sorry unclear title -

How to reverse the direction of Y-Axis of MatLab figure generated by `imagesc()` function -

Image
i trying display data in matrix using imagesc() function showing row index in decreasing order (assuming origin @ left-bottom). idea mistake making or how correct this? the matrix has zeros , ones in it. set ydir property of current axes normal by default, imagesc uses reverse ydir set(gca,'ydir','normal'); see documentation axes properties before: after: note: flips inside data (it supposed to). dealing matrices, hope want. if don't want affect inside data, need change order of yticklabels instead.

php - Include javascript files content in ob_start buffer -

i working on translation of website. perform translation easily, created .csv file containing matches between 2 languages (japanese->english). then, file parsed php, , ob_start() called on page in order replace wanted strings. here script : function lang_modify($buffer){ require('get_messages.php'); for($i=0; $i<count($messages); $i++){ $buffer = str_replace($messages[$i][0], $messages[$i][1], $buffer); } return $buffer; } $buffer = ob_start('lang_modify'); this script works on php/html files. however, ob_start not read javascript files wondering if knows way include javascript files output buffer ob_start() function replace words found in javascript well. someone adviced me search addfile statement (.htaccess) , don't know @ how use want. does have clue ? what facing here, separation of concerns issue. your translation generated ph

meteor - How can I create a method for retrieving user email address that is available on the client and server? -

i've got facebook, google , regular registration/login turned on on website. problem have email address stored in different fields depending on how user first joined. for regular users, in field emails[0].address . facebook , google authenticated users in field services[0].email . at various places in client (templates, events) , on server (method), want call 1 method works out field use , returns email address. want similar verification field. i'm new meteor , ways i've found above far repeat same logic in client , on server doesn't sit me. the best thing transfer email address 'emails' if log in facebook, google or services first time. make more future proof incase add other services, since meteor use emails.address (including in other packages) server side code: accounts.oncreateuser(function(user) { user.emails = user.emails || []; //if null set empty array if(user.services.facebook) { user.emails.push({address:

html - Misplaced link click areas in Android Mobile Chrome -

Image
i having troubles links on android mobile chrome. click area link misplaced, in mobile chrome browsers. everywhere else it's working flawlessly. can see here on image, blue rectangle click area in chrome: custom font problem, had same issue on app/mobile site. try disabling , link clickable areas magically come proper location.

How to work on existing branch/repository in GitLab created by other user? -

i new gitlab. have given access existing repository other user , supposed work on branch. not sure how can start working on project locally , commit changes. p.s.- have work using .net please guide me, helpful. thanks first need clone repository local machine. git clone git://gitlab.com/myproject now can see local branches $ git branch to see branches $ git branch -a now if want work on branch other master,you need create local branch tracking remote one. $ git checkout -b other_branch origin/other_branch now, can start working on other branch locally.hope helps.

r - Reactivity/renderPlot() not working in ggvis + Shiny -

i trying make shiny app user provides budgetary constraint, constraint formulates optimization equation maximizing protein (via lpsolve package), , optimization equation displayed in graph of protein-heavy foods (x-axis) vs. servings/wk (y-axis). when run current code, side panel pops up, graph in main panel doesn't appear. if delete renderplot() function, graph show up, isn't interactive. server.r : shinyserver( function(input, output) { # user inputs max amt spent on food/wk budget <- reactive({ as.numeric(input$budget) }) output$myplot <- renderplot({ # set optimization eq maximizing protein given constraints maxprot <- lp("max", snap2$protperserv, rbind(snap2$fatperserv, snap2$fatperserv, snap2$costperserv, snap2$sodiumperserv, snap2$fiberperserv, snap2$sugarperserv, snap2$calsperserv, snap2$calsperserv, snap2$fruit, snap2$vegs, snap2$grains, snap2$grains, snap2$meatprotein, snap2$dairy),

How can I migrate my MsSQL database on a hosted website to a MySQL database on a different hosted website? -

i have mssql 2008 database hosted on somee.com . have purchased hosting under net4.in providing me mysql database. now, how can migrate/synchronise mssql database mysql database ? i have tried below things in vain : there inbuilt facility provided in mysql in net4.in synchronise 2 databases on remote servers,where have tried selecting target server "current server" , in source server, have selected "remote server" , provided connection details available me somee.com . unfortunately, socket , port details not provided on somee.com, have tried giving various values "tcp/ip" , "1433"(the default value) in vain. there import facility in mysql in net4.in , in have given format of imported file "sql" , sql compatibility mode "mssql" , giving error showing encrypted text mssql database saying not able understand it. the easiest way export csv or .sql file of existing database import using our web-based db manageme

json - How to convert flat array of objects with "categories" and "subcategories" to tree with JQ? -

i have json array of objects groups , subgroups looks this: [ { "group name": "elevation", "subgroup": "contours", "name": "contours - labels" }, { "group name": "elevation", "subgroup": "contours", "name": "contours" }, { "group name": "elevation", "subgroup": "cuttings", "name": "cuttings" }, { "group name": "framework", "subgroup": "reserves", "name": "reserves" }, { "group name": "framework", "subgroup": "indigenous reserves", "name": "reserves" }, { "group name": "framework", "subgroup": "land borders", "name": "mainla

java - HQL WHERE clause where the condition is inside a hashset or list -

hi solving family tree problem. i have pojo class family public class family { private int familyid; private partners parents; private hashset<person> children; private hashset<family> descendantfamilies; //getters , setters. } public class person { private int personid; private string name; private gender gender; //enum class //getters , setters. } public class partners { private person husband; private person wife; //getters , setters } now check if person has brothers or sisters, i have check through families person 1 among children of family . new hibernate. have never searched condition through list or hashset. please help. hi try answer question because think you're looking elements keyword. can check through families person 1 among children of family using below hql:- select f family f ( :person in elements(f.children) ) this query give family containing person children. syntax like:- string hql = "select f

How to convert Ruby on Rails Model to a .json file? -

if have basic ruby on rails model set (like example typical blogpost application) index action like: def index @blogs=blog.all end how convert blogs .json file? know if do: def index @blogs=blog.all respond_to |format| format.html{} format.json{render json: @blogs.to_json} end this give json output (what want) @ following path: /blogs.json in browser, want actual .json file (not 1 being visible in browser @ path). how go doing this? just replace format.json{render json: @blogs.to_json} by format.json{send_data @blogs.to_json}

r - dplyr::group_by_ with character string input of several variable names -

i'm writing function user asked define 1 or more grouping variables in function call. data grouped using dplyr , works expected if there 1 grouping variable, haven't figured out how multiple grouping variables. example: x <- c("cyl") y <- c("cyl", "gear") dots <- list(~cyl, ~gear) library(dplyr) library(lazyeval) mtcars %>% group_by_(x) # groups cyl mtcars %>% group_by_(y) # groups cyl (not gear) mtcars %>% group_by_(.dots = dots) # groups cyl , gear, want. i tried turn y same dots using: mtcars %>% group_by_(.dots = interp(~var, var = list(y))) #error: is.call(expr) || is.name(expr) || is.atomic(expr) not true how use user-defined input string of > 1 variable names (like y in example) group data using dplyr? (this question somehow related this one not answered there.) no need interp here, use as.formula convert strings formulas: dots = sapply(y, . %>% {as.formu

javascript events - CollectionFS and CFS-S3 Meteor small help needed -

i created simple site handle uploads collectionfs, http://uploadapp.meteor.com/ , when click on upload uploads file as3 bucket if click on uploaded image in site , copy url gives me local url example: http://uploadapp.meteor.com/cfs/files/videos/tn877rsltc2s6snwg/download%20(1).jpeg?token=eyjhdxrovg9rzw4ioijhykpzvkz4v0dolulcqmjpbzdrduxxs3vuq3fdwdfboutsnzbbv1p3x0t3in0%3d this means image showing uploading mongodb , as3? how can make show , upload , directly as3? (the images stored as3 bucket upload working) the event handler upload form : template.hello.events({ 'change .fileinput':function(evt,tmpl){ fs.utility.eachfile(event,function(file){ var fileobj = new fs.file(file); videos.insert(fileobj),function(err){ console.log(err); } }) } }); the url proxy actual image. reason it's needs sign url displayed. it's not on mongodb on s3.

ios - UITableViewCell auto-sizing height not working -

Image
the cells in table view not auto-sizing height contain content. using "basic" style cell prototype. created new test project containing view controller , storyboard , has same issue. doing wrong? rowheighttestcontroller: @implementation rowheighttestcontroller #pragma mark - table view data source - (nsinteger)numberofsectionsintableview:(uitableview *)tableview { // return number of sections. return 1; } - (nsinteger)tableview:(uitableview *)tableview numberofrowsinsection:(nsinteger)section { // return number of rows in section. return 2; } - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { uitableviewcell *cell = [tableview dequeuereusablecellwithidentifier:@"test" forindexpath:indexpath]; // configure cell... cell.textlabel.text = @"testing"; cell.textlabel.font = [uifont systemfontofsize:60 + indexpath.row]; return cell; } @end the storyboard:

google cloud pubsub - Pull extremely slow when no messages on queue -

i using pubsub gmail push notifications. the pubsub subscription recieves messages expected. when pull messages have noticed if there no messages pull delay in getting response slow. if there @ least 1 message pull response timely has else experienced this? the fix can come leave message on queue. if (credential.requestaccesstokenasync(cancellationtoken.none).result) { var pubsubserivce = new google.apis.pubsub.v1beta2.pubsubservice( new baseclientservice.initializer() { httpclientinitializer = credential, applicationname = "ilink", }); pullrequest pr = new pullrequest(); pr.maxmessages = 100; pullresponse prs = pubsubserivce.projects.subscriptions.pull(pr, "projects/vivid-canyon-90023/subscriptions/ilink").execute(); acknowledgerequest ak = new acknowledgerequest(); if (prs != null && prs.receivedmessages != null) { ak.ackids = new list<string>();

C++ - ExpandEnvironmentStrings Giving Conversion Error -

i have been using this: char appdata[250]; expandenvironmentstrings("%appdata%\\\mcpcmodlocator\\", appdata, 250); in c++ win32 appdata folder on 1 of projects. worked fine, no issues. on newest project (same pc, still in visual studio 2013) when try that, error on first string saying "const char* incompatible type lpcwstr" , on second parameter says "char * incompatible type lpwstr". have no idea why work on first project, not second. assume setting change, looking through each projects settings, see nothing. appreciated! thanks! by default, newly created project in vs2013 has been set use unicode apis, use lpwstr (or, wchar_t*) instead of lpstr(or, char*). you can call old ansi version apis add "a" @ end of function name explicitly e.g. expandenvironmentstringsa or change project configuration use multibyte character set(project property pages -> configuration properties -> general -> character set)

Results missing from a mysql FULLTEXT boolean mode search -

i'm trying use fulltext index in order facilitate searching forum posts. it's not working in way expect, , i'm trying understand why not. for example, know there 1 post contains phrase "haha , got three" , perform query select * forum_posts match(message) against ('"haha , got three"' in boolean mode); and expect, find single post includes phrase. hooray! but perform related query: select * forum_posts match(message) against ('"and got three"' in boolean mode); and no results. in fact, searching word "three": select * forum_posts match(message) against ('three' in boolean mode); yields no results either. what going on? i think need learn stop words , minimum word length. my default, mysql ignores stop words in full text index. here list of them. "and got three" stop words. in addition, default, mysql ignores words less characters. controlled parameter. explained

django - permission denied (publickey) - AWS EC2 -

i trying django app running on amazon ec2. have .pem file saved in root of django project. when try this chmod 600 oby.pem ssh -i oby.pem ubuntu@52.0.215.90 in mac terminal, receive error: permission denied (publickey). to begin, saving oby.pem file in right location? if not, should go? furthermore, necessary steps correctly set ssh key? thank you!

java - Is using own int capacity faster than using .length field of an array? -

in "95% of performance clean representative models" talk martin thompson , between 17 , 21 minute, such code presented: public class queue { private final object[] buffer; private final int capacity; // rest of code } in 20:16 says: you can better performance, leaving things capacity in there right thing do. i tried come code example in capacity faster buffer.length , failed. martin saying problems arise in 2 scenerios: in concurrent world. but, length field final , jls 10.7 . so, don't see how problem. when cache misses. tried calling capacity vs buffer.length 1 million times (with queue having 1 million of elements), there no significant difference. used jmh benchmarking. could please provide code example, demonstrates case in capacity superior buffer.length in terms of performance? the more common case (frequently spotted in real code), better. please note, i'm totally taking away aspect of aesthetics, clean c

scala - Type synonyms in java -

is there anyway ( workaround ) define type synonyms in java, similar following definition in scala? type row = list[int]; though might not same, thinking of following code ( replaced list arraylist, since list interface in java): public class row extends arraylist<integer>{} is there other way achieve type synonym mechanism in java? unfortunately not. see is there java equivalent or methodology typedef keyword in c++? older duplicate of question, using c++ terminology instead of scala terminology.