Posts

Showing posts from June, 2015

windows - Installing mingwrt into the haskell-platform without mingw-get -

the haskell-platform (2014.2.0.0) ships minggw, without mingw-get. however, compile setlocale bindings haskell need locale.h, part of mingwrt. in usual mingw installation use mingw-get install mingwrt, since it's not included in haskell-platform doesn't work out of box. what usual way of installing mingwrt without mingw-get? install msys[^1] download version 1.0.11 of msys. you'll need following files: msys-1.0.11.exe msysdtk-1.0.1.exe msyscore-1.0.11-bin.tar.gz files hosted on haskell.org they're quite hard find in official mingw/msys repo run msys-1.0.11.exe followed msysdtk-1.0.1.exe. former asks if want run normalization step. can skip that. unpack msyscore-1.0.11-bin.tar.gz d:\msys\1.0. note can't using msys shell, because can't overwrite files in use, make copy of d:\msys\1.0, unpack there, , rename copy d:\msys\1.0. [^1]: setting haskell development environment on windows

ios - UIButton above UITableView -

i have tableview in uiviewcontroller. tableview not iboutlet. the uiviewcontroller has navigation bar due being pushed view. i want add uibutton above tableview, buttons/views not appear above tableview if add them in storyboard or use "bringsubviewtofront" method. i noticed buttons/vews appear behind navigation bar when translucent, of course not want them. none of these codes have worked: [self.view addsubview:btnsend];// add send btn [self.view bringsubviewtofront:btnsend];// bring send btn front [self.navigationcontroller.view addsubview:btnsend]; [self.navigationcontroller.view bringsubviewtofront:btnsend]; thanks in advance. you need set edgesforextendedlayout top not included self.edgesforextendedlayout = uirectedgeleft | uirectedgebottom | uirectedgeright;

Isn't F# supported in Visual Studio 2013 Update 3 and Azure SDK 2.4 -

Image
i installed visual studio 2013 update 3 , azure sdk 2.4. installed "microsoft azure tools microsoft visual studio 2013 -v2.4". tried repairing , reinstalling both sdk , azure tools. i can see 4 templates under cloud (azure cloud service,asp.net web application,microsoft azure webjob , azure mobile service) when creating c# project. there no cloud folder , no azure templates @ when creating f# project. is f# not supported or wrong installation? think supported earlier. the f# template worker roles available creating cloud service project. create cloud service project using c# or visual basic. next, selecting roles cloud service, can select f# worker role. full disclosure: i've not used f# template. recall seeing when creating c# projects.

google app engine - Configure GCS bucket to allow public write but not overwrite -

on google cloud storage, want public (allusers) able upload new files , download existing files, don't want public able overwrite existing file. background: upload , download urls typically determined own app. under normal conditions there no problem because app guarantees urls unique when writing. malicious user hack app , potentially able upload files (bad) cloud storage , overwrite existing files (very bad). i know solve problem proxying through app engine or using signed urls, trying avoid due timing constraints. timely processing essential app processes files (almost) in realtime , delay of 1,000 msec processing 2 consecutive requests long. would possible configure cloud storage in way error returned in case existing file hit during upload, such example: bucket: public has write access individual file: public has read access would work? happens in gcs if bucket , file acls contradictory? in above example bucket allow write access, if upload hits existing file rea

c# - Binding two viewmodel's with different hierarchy to one model -

Image
i have viewport3d entities, , treeview hierarchical structure of entities. treeview binded class hierarchy, this: public class somedataobject { private observablecollection<somedataobject> _children; private string _otherproperty; public somedataobject() { this._children = new observablecollection<somedataobject>(); //other initialization } public observablecollection<somedataobject> children { { return this._children; } set{ _children = value; } } public string otherproperty { { return this._otherproperty; } set{ _otherproperty = value; } } } i bind viewport otherproperty of objects, without hierarchy. viewport provides binding observablecollection, not include ancestors. therefore not have access otherproperty in lower levels. i think 2 separate viewmodels, don't know how design communication between

linux - Why does adding export DJANGO_SETTINGS_MODULE='myproject.settings' to bashrc no longer work? -

i have django app running on linux machine (debian). past little while app has run perfectly. needed reboot machine after celery tasks started hang , purging tasks didn't have desired effect. when attempt start celery using sudo celery -a myapp.tasks worker -ofair i presented following traceback traceback (most recent call last): file "/usr/local/bin/celery", line 9, in <module> load_entry_point('celery==3.1.11', 'console_scripts', 'celery')() file "/usr/local/lib/python2.7/dist-packages/celery/__main__.py", line 30, in main main() file "/usr/local/lib/python2.7/dist-packages/celery/bin/celery.py", line 81, in main cmd.execute_from_commandline(argv) file "/usr/local/lib/python2.7/dist-packages/celery/bin/celery.py", line 769, in execute_from_commandline super(celerycommand, self).execute_from_commandline(argv))) file "/usr/local/lib/python2.7/dist-packages/celery/bin/base

mysqli - Is there a functional equivalent to mysqli_fetch_all in PHP 5.2? -

so, total n00b @ php (and back-end programming in general), never less decided wanted build functioning database users search client-side th final project first web dev class. anyway, made site , database on localhost, , though took while, got functioning perfectly. when tried move webhost, however, started breaking because, unbeknownst me, webhost using php 5.2. i've been able rig else functioning solutions of dubious security (i know, know, i'm desperate, , there's fake data on here anyway), 1 thing can't find fix mysqli_fetch_all(). call undefined function mysqli_fetch_all() error. i'm using search functionality: when search user, function takes rows matching information , puts in array, , @ end, result arrays merged single array returned. did way search criteria not entered ignored , not return error (null has been bane of existence entire project). the site can viewed @ http://webinfofinal.webatu.com/profiles.html see i'm working , code below. su

forms - Bootstrap 3 contact modal is not showing up -

i have small contact modal on website not appear. working before, must have changed , won't work. i've looked on multiple times , can't figure out why it's not working. html: <a href="contact"><span data-toggle="modal">contact</span></a> <div class="modal fade" id="contact" role="dialog"> <div class="modal-dialog"> <div class="modal-content"> <form class="form-horizontal"> <div class="modal-header"> <h4>contact developers</h4> </div> <div class="modal-body"> <div class="form-group"> <label for="contact-name" class="col-lg-2 control-label">name:</label> <div class="col-lg

python - django mysql force usage of index -

i'm using django orm , mysql. reason mysql using wrong index. want manually override index used. saw django team decided cross platform reason prevent usage of with_hints extension force index. have kind if solution \ proposal how mysql use correct index through django? thanks django supports raw sql queries fit needs, see documentation article performing raw sql queries . when model query apis don’t go far enough, can fall writing raw sql. django gives 2 ways of performing raw sql queries: can use manager.raw() perform raw queries , return model instances, or can avoid model layer entirely , execute custom sql directly.

java - Which platform to start on? -

i looking write 2d in java. release both android marketplace , online game can played online on browser. should write using android sdk , convert normal java or other way round? my suggestion be... first think design of application such way don't have repeat/write main graphics classes in both of android app , web application. then start writing application android because challenge since have support whole list of devices. web can customize things bit , recent browser support same structure there less effort on there.

pinvoke - Passing multiple parameters using CreateRemoteThread in C# -

my goal call function in remote process using p/invoke in c# (createremotethread). problem function takes more 1 parameter. there way pass multiple parameters function? [dllimport("kernel32.dll", setlasterror = true, exactspelling = true)] static extern intptr openprocess(int dwdesiredaccess, bool binherithandle, int dwprocessid); [dllimport("kernel32.dll", setlasterror = true, exactspelling = true)] static extern intptr virtualallocex(intptr hprocess, intptr lpaddress, uint dwsize, allocationtype flallocationtype, memoryprotection flprotect); [dllimport("kernel32.dll", setlasterror = true)] static extern bool writeprocessmemory(intptr hprocess, intptr lpbaseaddress, intptr lpbuffer, uint nsize, out uintptr lpnumberofbyteswritten); [flags] public enum allocationtype { commit = 0x1000, reserve = 0x2000, decommit = 0x4000, release = 0x8000, reset = 0x80000, physical = 0x400000, topdown = 0x100000, writewatch =

sql server - Invalid Object Name, Temporary Table Entity Framework -

i´m trying optimize process in application i´m stuck problem. application working entity mapping correct. simplifying i´m trying this: using (var offctx = new checkinofflineentities()) { using (var trans = offctx.database.begintransaction(isolationlevel.snapshot)) { datetime purgepivot = datetime.now.adddays(-2); count = offctx.database.executesqlcommand(@"select l.* #newlegs inventoryleg l l.stdutc >= {0}", purgepivot); long d = offctx.database.sqlquery<long>("select count(*) #newlegs").firstordefault(); } } i´m selecting data want delete 1 table, storing in temporary table can use temporary table in other queries exclude related data. the problem is, when try use temporary table i´m receiving exception sqlexception: "invalid object name '#newlegs'." thank time. you can merge query this. and count returns int, not long. count returns int data type value. - msdn var quer

r - how do I use nls to estimate parameters? -

i want estimate e50 e0 emax emax model equation y=e0 + ((dose * emax)/(dose + ed50)) want use default algorithm how can estimate e0 emax , e50? i found example code : args(nls) function (formula, data = parent.frame(), start, control = nls.control(), algorithm = c("default", "plinear", "port"), trace = false, subset, weights, na.action, model = false, lower = -inf, upper = inf, ...) null thanks your example data doesn't seem named, i'll pretend didn't see it. make vector called dose contains dose information , vector called y contains y variable. should same length. i'll use rnorm() example. call nls reasonable start values. i'll pick out of blue. > dose <- rnorm(400) > y <- rnorm(400) > nls(formula=y~e0+((dose*emax)/(dose+ed50)),start=c(e0=1,emax=10,ed50=2)) nonlinear regression model model: y ~ e0 + ((dose * emax)/(dose + ed50)) data: parent.frame() e0 emax ed50 0.036105

objective c - Accessing a variable using string -

i wondering if 1 of me little problem having, if possible. have few global variables called checklista, checklistb, etc. want, if user selects table cell called a, checklista passed on destination controller. in other words: global variables: nsarrays -> "checklista", "checklistb", "checklistc", etc. cells: "a", "b", "c", etc ... on click of cell b... destinationcontroller.checklist = nsarray named: "checklistb" hope clear, if have questions feel free ask. thank in advance! i believe table view has delegate method implemented: tableview:(uitableview *)tableview didselectrowatindexpath:(nsindexpath *)indexpath you notified whenever cell selected(tapped) user. you can implement delegate method in way: - (void)tableview:(uitableview *)tableview didselectrowatindexpath:(nsindexpath *)indexpath { if( indexpath.row == 0) /// first cell { _selectedchecklist = checklista; }

excel vba - Return an Index number from a collection VBA -

if have created collection, can search search collection , return index number within collection? due newbie status, can't post screenshots of i'm trying do, let me try explain i'm trying accomplish: i have history log warehouse database in excel format several thousand lines long-- each line representing transaction of product moving in or out of many 10 different bins. goal identify possible different bins in thousands of lines, copy/transpose ~10 bins column headers, , go through each transaction , copy transaction quantity (+1,-3, etc) correct column, being able separate transactions , more identify , generate accounting of when product moved in/out of each respective bin. sort of pivottable, isn't how work. here code working on far, comments. problem explained in last comment: sub forensicinventory() dim binlocat collection dim rng range dim cell range dim sh worksheet dim vnum variant dim bincol integer dim actcol integer dim qtycol integer dim in

ios - FBDialogs canPresentMessageDialogWithParams returns false -

i'm trying add facebook sdk ios version of app. login, logout, share, , request features working, i'm having difficulty getting messagedialog feature work. facebook app , facebook messenger app installed on devices. however, every time call 'fbdialog canpresentmessagedialogwithparams:params' returns false. my guess feature doesn't work while app still in development mode, guess. know if message dialog works apps under development? or have ideas doing wrong? i've included code in case i've made bone-headed mistakes. appreciated! // check if facebook app installed , can present share dialog fblinkshareparams *params = [[fblinkshareparams alloc] init]; params.link = [nsurl urlwithstring:@"https://www.facebook.com/"]; params.name = @"flash bear"; params.caption = nil; params.picture = nil; params.linkdescription = @"i'm playing flash bear. why don't come join me?"; // if facebook messenger app installed , can pre

sublimetext - Unable to run processing pde file in Sublime Text -

i trying run example file hype framework in sublime text , when hit ctrl + b "could not create output folder". any thoughts? link example code: http://www.hypeframework.org/examples/hoscillator/example_001/index.html try checking build system under tools > build system > processing .

Wordpress JWPlayer Plugin how to EDIT the Playlist -

i'm using wp 3.8.1 , jwplayer plugin 6 2.1.2 . there made new playlists. how edit (add/remove) entry items inside existing playlist? there no edit button. using jw player plugin wordpress, once playlist has been created via admin's playlist manager, playlists can edited. need select created playlist dropdown menu, , can change order of items in playlist dragging items around, or if want remove items, can drag items out of playlist right side. if want add items playlist, can dragged in.

javascript - Display function output within an anonymous function -

i trying output selected text within javascript code. created function selected text , want output when submit button output. here's javascript getting selected html or text. function getselectionhtml() { var html = ""; if (typeof window.getselection != "undefined") { var sel = window.getselection(); if (sel.rangecount) { var container = document.createelement("div"); (var = 0, len = sel.rangecount; < len; ++i) { container.appendchild(sel.getrangeat(i).clonecontents()); } html = container.innerhtml; } } else if (typeof document.selection != "undefined") { if (document.selection.type == "text") { html = document.selection.createrange().htmltext; } } document.write(html); } here's code outputting other content plus function above (but wont show up) (function() { tinymce.pluginm

java - Error in "Eclipse Plugin for Scala" while compiling a Spark class -

i using cdh5.1.0 simple spark programming. also, have eclipse juno (comes vm) , installed scala ide plugin 2.10.0. getting following error in ide: bad symbolic reference. signature in sparkcontext.class refers term io in package org.apache.hadoop not available. may missing current classpath, or version on classpath might incompatible version used when compiling sparkcontext.class. simpleapp.scala /myscalaproject/src/com/test/spark1 line 10 scala problem code: package com.test.spark1 import org.apache.spark.sparkconf import org.apache.spark.sparkcontext import org.apache.spark.sparkcontext._ object simpleapp { def main(args: array[string]) { val logfile = "/home/desktop/scala/sparktest.txt" // should file on system val conf = new org.apache.spark.sparkconf().setappname("simple application") val sc = new sparkcontext(conf) val logdata = sc.textfile(logfile, 2).cache() val numas = logdata.filter(line => line.contains("a"

Makefile : why pu .o instead of .c in dependencies? -

in tutorial : http://www.cs.colby.edu/maxwell/courses/tutorials/maketutor/ i don't understand why uses .c dependencies in makefile1 , .o in makefile2 . can put .o , .c regardless in gcc ? what's advantage of using .o ? 1) it's right there in tutorial: "by putting object files--hellomake.o , hellofunc.o--in dependency list , in rule, make knows must first compile .c versions individually, , build executable hellomake." not strictly correct, can see author meant. 2) can either way, should aware of these 2 methods do. also, compare: gcc -o hellomake hellomake.c hellofunc.c -i. gcc -o hellomake hellomake.o hellofunc.o the -i. isn't needed in second usage; compiler can't use , ignore it. (yes, know command in tutorial uses it-- author wrong.) 3) biggest advantage know of ability keep object files ( foo.o ) avoid unnecessary recompilation later; there may others.

php - How to detect changed part of multiple texts -

i got multiple string in array should find part (=words) changed (what changed text , located). algorithm should use? input $strings = [ 'a' => 'blah blah. value of 123456 , 50%.', 'b' => 'blah blah. value of 10203 , 75%.', 'c' => 'blah blah. value of 9999 , 500%.', // more rows ]; output $output = 'blah blah. value of [a=123456|b=10203|c=9999] , [a=50%|b=75%|c=500%].'; (yes, i'm going add fancy html mouseover @ point ..) currently i'm doing experiments php-finediff , it's huge mess if want compare more 2 strings each-other. (should write huge loop check characters 1 @ time or try regular expressions or .. ?) this should bit closer finding answer; can split each sentence arrays of words, run array_diff() on them collectively. combine words , create arrays found match earlier: $strings = [ 'a' => 'blah blah. value of 123456 , 50%.', 'b

matplotlib - Installing Numpy for Python 3.3 on Mac Mavericks OS 10.9 -

i trying install numpy (so can run matplotlibs) python 3.3 on mac mavericks. have windows machine , able install correctly downloading .exe files. however, new mac world, , have never installed via command line before. i have downloaded anaconda , xcode. i have tried: pip install numpy and following output: requirement satisfied (use --upgrade upgrade): numpy in ./anaconda/lib/python2.7/site-packages it looks has 2.7 installed already, want 3.3! so, next tried: pip-3.3 install numpy and following output: pip-3.3: command not found i have tried use anaconda after these have failed (having never used anaconda before): conda create -n myenv python=3 conda install -n myenv numpy scipy matplotlib ipython after said , done, got message: # requested packages installed. # packages in environment @ /users/username/anaconda/envs/myenv: # ipython 2.2.0 py34_1 matplotlib 1.3.1 np18py34_1 numpy

Winform equivalent to Android's fragments? -

you know, in ccleaner app main activity on left side of app , right side area changeable fragment. http://cache.filehippo.com/img/ex/3049__ccleaner1.png how it? imagine putting fragments in same place , change visibility show 1 @ moment, make code whole lot of mess. i've done in past using usercontrols. it's worked nicely things choosing payment methods (cash, cc, cheque...). there couple of options changing display, either have usercontrols present on form , hide or show them required or have empty placeholder panel , use factory construct appropriate usercontrol needed. i've done both , depends on complexity (and expected longevity , users) of project appropriate. using model-view-presenter pattern helped managing of this. what don't want end massive switch statement changes visibility of dozens of manually positioned controls individually. i've seen , way lies madness.

c# - how to match multiple words in string using regex? -

i trying match 3 words can appear anywhere in string: win enter all 3 words must exist in string return match. having issues getting match when 3 words exist. below regex using: http://regexr.com/39b83 ^(?=.*?win)(?=.*?(enter))(?=.*?(now)).* regex working when 3 words within same line ... when spread out across entire string on different lines, failing match. any direction or appreciated. i think c# support (?s) dotall modifier. if yes try below regex, (?i)(?s)win.*?enter.*?now

java - Mysql jconnector spends 50% time in com.myql.jdbc.utils.ReadAheadInputStream.fill() -

i profiling application uses spring + hibernate + mysql-java-connector. visualvm shows more 50% cpu time cost in com.myql.jdbc.utils.readaheadinputstream.fill(), when there 1000 parallel connections doing read. is there optimization make faster? on top of other suggestions, consider experimenting lower amount of connections (i.e. 20). it's possible overhead of handling such large amount of open connections fooling profiling observations. not least, make sure you're using recent version of hibernate orm. made version 5.0+ smarter previous versions, regarding performance improvements ;-) improvements applied daily, keeping date or @ least trying latest might easy win.

php - Yii framework : Display value from relation table in admin form -

i have admin.php created gii, inside there's table column 'lang_id' have relation primary key 'id' of table 'lang'. what should put in columns array ? think should use "lang.name" didn't work. protect/view/mainmenu/admin.php <?php $this->widget('zii.widgets.grid.cgridview', array( 'id'=>'mainmenu-grid', 'dataprovider'=>$model->search(), 'filter'=>$model, 'columns'=>array( 'menu_id', 'lang.name', // want column display name of language, instead of lang_id 'name', 'remark', array( 'class'=>'cbuttoncolumn', 'template'=>'{update}' ), ), )); ?> protect/model/mainmenu.php public function relations(){ return array( 'lang'=>array(self::has_one, 'lang', 'lang_id')

objective c - How to stop execution of for loop in middle in ios -

hi in application have 2 types of syncs. 1.auto sync 2.manual sync. in both syncs downloding bunch of files server. if choose auto sync files download. code for(int i=0;i<filescount;i++) { [self downloadfiles]; } -(void)download files { //here creating `nsinvocationoperation`. if(!synchingfilecount) totalreceiveddata=0; } based on totalreceiveddata updating progress bar. issue if autosync working fine.while downloading files using autosync , in middle if click manual sync time [self downloadfiles]; method called issue synchingfilescount not updating it's completeing autosyncfiles download , synchingfilescount become 0 due reason totalreceiveddata become 0 , progress bar disappearing. after complete opertiona again synchingfilecount becomes 4 cannot able see progress bar due above situation. please 1 me how can come out situation. ok, if understand question correctly, sounds need create flags can manage flow of code. can making boolean p

node.js - Explain to Mean.io beginner how Mean.io sample package's authentication works -

i'm learning mean.io this tutorial video , shows example package (created mean package mymodule . described under "packages" on docs ). in understanding how given authentication/authorization works. the default sample package/module has simple user authentication on client side myapp/packages/mymodule/public/views/index.html contains: <li> <a href="mymodule/example/anyone">server route can access</a> </li> <li> <a href="mymodule/example/auth">server route requires authentication</a> </li> <li> <a href="mymodule/example/admin">server route requires admin user</a> </li> on server side, myapp/packages/mymodule/server/routes/mymodule.js , contains: // package past automatically first parameter module.exports = function(mymodule, app, auth, database) { app.get('/mymodule/example/anyone', function(req, res,

MySQL - each total sales of all items -

Image
the following mysql query getting total sales of each item purchased user id 31 in 2014. select op.products_name, round(sum( if(month(o.date_purchased) = 1, op.final_price * op.products_quantity,0)), 2) january, round(sum( if(month(o.date_purchased) = 2, op.final_price * op.products_quantity,0)), 2) febraury, round(sum( if(month(o.date_purchased) = 3, op.final_price * op.products_quantity,0)), 2) march, round(sum( if(month(o.date_purchased) = 4, op.final_price * op.products_quantity,0)), 2) april, round(sum( if(month(o.date_purchased) = 5, op.final_price * op.products_quantity,0)), 2) may, round(sum( if(month(o.date_purchased) = 6, op.final_price * op.products_quantity,0)), 2) june, round(sum( if(month(o.date_purchased) = 7, op.final_price * op.products_quantity,0)), 2) july, round(sum( if(month(o.date_purchased) = 8, op.final_price * op.products_quantity,0)), 2) august, round(sum( if(month(o.date_purchased) = 9, op.final_price * op.prod

Elasticsearch multi term query rewrite -

i'm trying understand how use elasticsearch , stumbled @ concept of multi term query rewrite . my question exactly? affect score calculation or changes whole query being parsed? or else? light appreciated! ps: looking @ this thread sort of suggests me has fuzzy score calculation.

How do I change PHP's date programatically? -

how change php's time-zone settings, programatically, without configuring them in php.ini i think you're looking is: date_default_timezone_set(); see php manual: http://php.net/manual/en/function.date-default-timezone-set.php usage be: date_default_timezone_set('america/los_angeles') .

access javascript variable in page load event c# -

i setting session variable in page1.aspx inside document.ready sessionstorage.setitem('prepayamt', 'some value stored'); now want value in page2.aspx page load event protected void page_load(object sender, eventargs e) { // value here } i have declared script section in page2.aspx able value <script type="text/javascript"> $(document).ready(function () { var pre_pay = sessionstorage.getitem('prepayamt'); alert(pre_pay); }); </script> i have got 1 hidden variable in page2.aspx as <asp:hiddenfield runat="server" id="hdnprepayamt" /> you correct try , set hidden value gets posted back, if use sever-side asp.net hiddenfield (i.e. asp:hiddenfield ) need specify clientid="hdnprepayamt" setting , not id= e.g. <asp:hiddenfield runat="server" clientid="hdnprepayamt" /> as <asp:hiddenfield runat="server" id

ios - Unwind segue from navigation back button in Swift -

Image
i have settings screen, in have table cell. clicking on take screen user can choose option , want in previous view controller when button pressed. i can put custom bar button item, want return parent view controller using button in navigation bar rather custom button on view. i dont seem able override navigation button point down unwind segue action , since button doesnt appear on storyboard, cant drag green exit button it is possible unwind push segue button? i achieved trying do, i.e., pass data in navigation controller stack using delegate method: http://makeapppie.com/2014/07/05/using-delegates-and-segues-part-2-the-pizza-demo-app/

php - PHPMailer can not send email now -

this question has answer here: phpmailer cannot send email 2 answers anyone have project send email localhost using phpmailer send email ? i have 2 project using , it's stop send email both, it's show message smtp error: not connect smtp host. same, think phpmailer have problem ? any 1 meeting problem me or it's imagine ? the way have setup, require smtp server running on localhost send messages through. if don't have smtp server running on localhost, can use external smtp server relay messages through. here working example: having trouble phpmailer

php - Create a nested array -

i have table below id 1 2 4 title home page about deneme slug home about deneme order 1 2 1 body loremp ipsum dot sit color amet parent_id 2 0 0 now, want create nested array table. function below public function get_nested () { $pages = $this->db->get('pages')->result_array(); $array = array(); foreach ($pages $page) { if (! $page['parent_id']) { $array[$page['id']] = $page; } else { $array[$page['parent_id']]['children'][] = $page; } } return $array; } dump($array); when dump $array dump => array(2) { [2] => array(6) { ["id"] => string(1) "2" ["title"] => string(5) "about" ["slug"] => string(5) "about" ["order"] => string(1) "2" ["body"] => string(241) "lorem ipsum dolor sit amet, consectetur adipisicing elit. ipsam itaque cumque u

javascript - Z-Index Behaving Differently in Chrome and Safari -

i've been working on 3d piece http://jsbin.com/vihoye/3/edit?html,output it's perfect exception final hurdle. reason z-index behaving differently in chrome , safari. there 2 things going wrong here both positioning issues. issue #1 the solar system controlled menu lower right. when click on "life skills" info dialogue pops on planet. in firefox when mouse on dialogue triggers pop-up should. in chrome , safari can't trigger mouseover event. issue #2 in firefox, once mouseover event triggered popup appears on top of solar system should. however, in chrome , safari planets rotate thru pop-up. i can't figure out if position property or if rotatey causing problem. any suggestions? in advance help. okay here solution demo js bin . working in chrome in safari planets rotate thru pop-up still. more debugging , may fixable not bad of anomaly. i changed 1 css id accordingly: #galaxy { position: fixed; width: 100%; height

pentaho - Add percentages to an OLAP cube Mondrian schema -

i calculate percentage of 1 of measures. example: have measure aggregator distinct-count. calculate percentage of measure, based on current information. for example: gender users-distinct-count percentage male 25 25% (25/100) female 41 41% (41/100) unk 34 34% (34/100) but, if filter out unk, want percentage out of 25+41, i.e. 66 gender users-distinct-count percentage male 25 37.8% (25/66) female 41 %62.2 (41/66) i want, when viewing data different dimensions, total sum updated accordingly. i tried this: <calculatedmember name="user_percentage" caption="users percentage" formula="[measures].user_count/ ([measures].user_count,[dim1].[all dim1],[dim2].[all dim2])" dimension="measures" visible="true"> </calculatedmember>

android - Change font in my listView -

so listview of mine giving me headaches. working , all, can't seem change font of text in lv. this code: public class myactivity3 extends activity { private textview tv; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_my3); button m = (button) findviewbyid(r.id.button3); tv = (textview) findviewbyid(r.id.textviewcat); typeface typeface = typeface.createfromasset(getassets(), "bebasneue bold.ttf"); tv.settypeface(typeface); string listarray[] = new string[] { "india", "england", "canada", "new zealand", "south africa", "pakistan", "west indies" }; int icon[] = new int[] { r.drawable.ic_launcher, r.drawable.ic_launcher, r.drawable.ic_launcher, r.drawable.ic_launcher, r.drawable.ic_launcher, r.drawable.ic_launcher, r.drawable.ic_launch

regex - Java - Split string based on space and single quote but ignore two single quotes -

Image
i want split string using space , single quote. 2 single quotes should ignored. input: name eq 'a''b' output should be: name eq a''b i tried use [^\\s\"(?<!')'(?!')]+|\"[^\"]*\"|(?<!')'(?!')[^(?<!')'(?!')]*(?<!')'(?!')" but not work. the following 1 should suit needs: '(?:[^']|'')+'|[^ ]+ debuggex demo java example: string input = "foobar foo bar 'foobar' 'foo bar' 'foo''bar'"; pattern pattern = pattern.compile("'(?:[^']|'')+'|[^ ]+"); matcher matcher = pattern.matcher(input); while (matcher.find()) { string match = matcher.group(); system.out.println(match); } ideone demo

c# - TcpListener doesn't connect/establish a connection -

i'm trying start connection without manualresetevent, it's skip beginacceptsocket telling me press key continue, although manualresetevent succeeded connection client sends me irrelevant bytes. static void main(string[] args) { tcplistener = new tcplistener(ipaddress.any, 8484); tcplistener.start(); tcplistener.beginacceptsocket(acceptsocket, tcplistener); } private static void acceptsocket(iasyncresult async) { new client(tcplistener.endacceptsocket(async)); tcplistener.beginacceptsocket(acceptsocket, null); } for example consider client acceptor incoming bytes. beginacceptsocket asynchronous; not running on same thread main , , result, program ending before connection received. remedy this, either convert synchronous accept or keep main thread active prevent program closing. recommend read on implications of asynchronous methods before using such methods. i need see manualresetevent code

unit testing - How to mark a jasmine test incomplete? -

Image
in jasmine 2.0 can use xit instead of it make jasmine skip test. disabling suites i forget these tests since don't appear in result. hoping mark these tests incomplete, should warn me @ at point. is possible mark them disabled/incomplete appear in results such? you pretty linked answer in question already. everything, ask described here . example xdescribe('disabled suits', function() { it('test one', function() { }); it('test two', function() { }); it('test three', function() { }); it('test four', function() { }); }); describe('disabled suits tests', function() { it('enabled test one', function() { }); it('enabled test two', function() { }); xit('disabled test one', function() { }); xit('disabled test two', function() { }); }); exception first example isn't displayed @ in output. not sure why. ma

c++ - Direct2D WM_MOUSEMOVE message with scaled display -

i new direct2d programming , have encountered issue wm_mousemove message handling. as documented in msdn , should use enum handle mouse move, , should use loword & hiword extract current x , y coordinates. that works fine when working on normal display, when trying run on scaled displays (e.g. 125% in case), values of x , y aren't accurate, in other words, there "indentation" between current position of mouse , values extracted lparam. i guess should query os or window current scaling can calculate right position, don't know how! any please? you can take control of scaling declaring program dpi aware. automatic scaling stop , you'll original coordinates. you'll need scale window though. creating dpi-aware application

sql server - How to run sql script using powershell? -

i wanted run sql script using powershell getting error "the term 'invoke-sqlcmd' not recognized name of cmdlet, function, script file, or operable program. check t spelling of name, or if path included, verify path correct , try again." i have found below snippet website.but 1 sql command..but wanted run sql script. could please in modifying below sql script or better suggestion ? sqlserver = "abcd\abc" $sqldbname = "abc_1223" $sqlquery = "select * table" $sqlconnection = new-object system.data.sqlclient.sqlconnection $sqlconnection.connectionstring = "server = $sqlserver; database =$sqldbname;uid=$sqldbname;pwd= $pwd; integrated security = true" $sqlcmd = new-object system.data.sqlclient.sqlcommand $sqlcmd.commandtext = $sqlquery $sqlcmd.connection = $sqlconnection $sqladapter = new-object system.data.sqlclient.sqldataadapter $sqladapter.selectcommand = $sqlcmd $datas

html - Set List Box width to fill column width in Bootstrap -

i have 3 list boxes part of html. list box fill column, width of listbox same width of column , not able so. in 'col-md-12', width of list box should width of screen. have tried this: set width of list box "width:100%" on each individual listbox. set width of parent div "width:100%" on each individual listbox. i have tried use container-fluid on root div. but no luck. i not want set width static size ('width: 550px'). <div class="form-horizontal container"> <hr /> <div class="form-group row"> <div class="col-md-6"> <select class="form-control" multiple="multiple" style="font-size:large"> <option value="1">test234</option> <option value="3">test123</option> </select> </div> <div class="col-md-6&q

header - C language, proper usage of include guards -

i'm trying create header file (that include functions wrote avl trees) having slight problem , misunderstanding syntax of include guards. right code looks this #ifndef stdio_h #define stdio_h #endif #ifndef stdlib_h #define stdlib_h #endif #ifndef conio_h #define conio_h #endif problem is, think includes <stdio.h> . when try use malloc, says malloc undefined, though included stdlib. according http://www.cprogramming.com/reference/preprocessor/ifndef.html if understood correctly, ifndef checks if token defined, , if isnt, defines write after ifndef , until #endif. code should work. is stdio defined? no. define it. endif. stdlib defined? no. define it. endif. conio defined? no. define it. endif. don't see problem. what correct syntax if want add 3 headers? include guards used prevent double definition in case include file included more once. the standard include files have necessary include guards, need no include guards them. your code should

aop - How to pass literal parameter to advice method? -

it possible pass literal parameter advice method? for example: <aop:before pointcut="execution(public * anothermethod(..))" method="mymethod(java.lang.string)"/> in example, want pass literal string "mymethod" before "anothermethod" executed. possible? thanks in advance

c# - Convert DatePicker Value to String in windows store app -

i have converted date picker values string this bookingdate = date.date.tostring(); but gives value 18-aug-14 3:21:01 pm -07:00 . want in format 18/8/14 , how this? you can format datetime like; date.date.tostring(@"dd\/m\/yy"); or date.date.tostring("dd'/'m'/'yy"); and don't believe datetime.date property returns pm -07:00 hour because documentation; a new object same date instance, , time value set 12:00:00 midnight (00:00:00) .

http headers - How to send file name with NanoHttpd Response -

i've achieved file transfer on local network using nanohttpd. however, i'm unable send file name in nanohttpd response. received files have default name this: localhost_8080. tried attach file name in response header using content-disposition , file transfer failed together. doing wrong? here implementation: private class webserver extends nanohttpd { string mime_type; file file; public webserver() { super(port); } @override public response serve(string uri, method method, map<string, string> header, map<string, string> parameters, map<string, string> files) { try { file=new file(filetostream); fis = new fileinputstream(file); bis = new bufferedinputstream(fis); mime_type= urlconnection.guesscontenttypefromname(file.getname()); } catch (ioexception ioe) { log.w("httpd", ioe.tostring()); } nanohttp