Posts

Showing posts from July, 2014

mysql - php sql syntax, fetching random row w/ includes row with id variable -

apologies not wording title properly. i'm looking pull random mysql id has genre value set electro select * rtsubmissions order rand() `$genretypefix` desc limit 0, 1 fred solved first part, order after where.. still cannot variable work though edit: $sorttype = $_get['sort']; $genretype = $_get['gn']; $genretypefix = "genre='" . $genretype . "'"; if ($sorttype == 'new') { $sql = " select * rtsubmissions order id desc limit 0, 1 "; } elseif ($sorttype == 'genre') { $sql = " select * rtsubmissions `$genretypefix` order rand() desc limit 0, 1 "; } else { $sql = " select * rtsubmissions order played desc limit 0, 1 "; } edit2: removed ` per comment , works, thank-you try this: "select * rtsubmissions $genretypefix order rand() desc limit 0, 1"

android - Getting NullPointerException in searchview on action bar -

i working on application in setting searchview widget on action bar. getting null pointer exception . not getting idea why it's happening. followed many post none of them helping. please guide me if making mistake... snippets are searchactivity.java public class searchactivity extends actionbaractivity{ @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_search); getactionbar().setdisplayhomeasupenabled(true); getactionbar().sethomebuttonenabled(true); handleintent(getintent()); } private void handleintent(intent intent) { if(intent.action_search.equals(intent.getaction())) { string query = intent.getstringextra(searchmanager.query); dosearch(query); }else if(intent.action_view.equals(intent.getaction())){ getplace(intent.getstringextra(searchmanager.extra_data_key)); } } @...

jquery - MVC Asynchronous Ajax Calls -

i'm working on ecommerce website , have following template: <div class="product-box"> product 1 </div> <div class="product-box"> product 2 </div> <div class="product-box"> product 3 </div> the website asp.net mvc, want fill different product box product information asynchronously using jquery ajax calls mvc controller, best way it? i can think of that <div id="product1" class="product-box"> product 1 </div> <div id="product2" class="product-box"> product 2 </div> <div id="product3" class="product-box"> product 3 </div> <script> $.get("/getproductinfo/1", {}, function (data) { $("#product1").html(data); }); $.get("/getproductinfo/2", {}, function (data) { $("#product2").html(data); }); $.get("/getproductinfo/3", {}, fu...

linq - How to get total count of children of a class containing Dictionary of same type? -

i have 'node' class follows: public class node { public readonly idictionary<string, node> _nodes = new dictionary<string, node>(); public string path { get; set; } } i want total child count of _nodes of object of above class. there can level of depths. let suppose create object as: node obj = new node(); after iterating, wish total no of node s @ levels of depth. tried following not working: foreach (var item in obj._nodes) { count += item.value._nodes.selectmany(list => list.value._nodes).distinct().count(); } a typical solution problem create recursive method , this: public class node { public readonly idictionary<string, node> _nodes = new dictionary<string, node>(); public int gettotalchildrencount() { return _nodes.values.sum(n => n.gettotalchildrencount() + 1); } } + 1 part used count node itself, apart number of children. i've omitted call distinct func...

android - How to remove 'unremovable' consoles from eclipse -

Image
i don't work android time, working server/client app , need check console output of both. used able pressing little blue monitor button on console view toggle between two. have other 3 irremovable consoles(ddms, opengl trace view, android) don't use, not when developing android. want know how permanently remove 3 console views. don't want have separated eclipse installations nor having install/uninstall plugins whenever not developing android. i prepared delete/modify plugin source files, don't know looking for you don't have modify . 1)go " windows->open perspective " , choose 2) or go windows->show perspective select suits you.

excel vba - VBA to copy cell from Sheet"A" to merged cells in Sheet"B" -

how copy single cell raw worksheet"a" merged cells raw in worksheet"b" , suppose go next line in merged cells? have following vba work row 5 not other rows. private sub decisionbtn_click() if sheets("baseline_ra").cells(activecell.row, 14).value = "health risk assessment" sheets("health ra").range("a5").value = sheets("baseline_ra").cells(activecell.row, 1) sheets("health ra").range("b5").value = sheets("baseline_ra").cells(activecell.row, 2) sheets("health ra").range("i5").value = sheets("baseline_ra").cells(activecell.row, 8) sheets("health ra").range("o5").value = sheets("baseline_ra").cells(activecell.row, 11) sheets("health ra").range("p5").value = sheets("baseline_ra").cells(activecell.row, 12) sheets("health ra").range("q5").value = sheets(...

angularjs - Ng-grid and sorting array data -

i'm using ng-grid data source array of arrays so $scope.mydata = [ ["moroni", "m"], ["tiancum", "t"], ["jacob", "j"], ["nephi", "n"], ["enos", "e"] ] the full example can found on plunker http://plnkr.co/edit/lk6rnzagheeohmmkb1ri?p=preview the actual problem data not sort while user clicks column headers. expected behaviour? there way data sort when click column? thanks

php: convert array variable to string? -

string converting array <?php $value1 = "hello, world"; $convert = explode(" ",$value1); echo $convert[1]; //hello echo $convert[2]; //world // convert particular number of array string $s = implode(" ", $convert[2]); ?> i want output : world error message: error: warning: implode(): invalid arguments passed in i tried, not done 1 if want output world , should work: <?php $value1 = "hello, world"; $convert = explode(", ",$value1); //echo $convert[0]; //hello echo $convert[1]; //world ?>

java - Do we really need to call flush() just before close() today? -

i read question using flush() before close() , , accepted answer means follow pattern. just bufferedwriter#close() or filteroutputstream.#close() , if of buffered stream/writer call flush() when call close() , if (the dev , dev review code) know that, still need this? if yes, reason? as javadoc says, don't need flush yourself. but, it's still do, considering readers, , common sense. few experts know javadoc heart. wouldn't know sure if stream flushed or not without looking up, , i'm not alone. seeing explicit flush() call makes clear, , therefore makes code easier read. furthermore, method name close() implies nothing flushing. it's closeable interface, , naturally, says nothing flushing. if don't flush buffered output stream before closing, despite wanting flush it, you'll relying on assumptions may or may not true. weaken implementation. any assumptions make, should somehow pass on future maintainers. 1 way leaving comment:...

Download or share view in Android -

Image
i have view: my question: i want give user option download or email information. how can do? the easiest way came sort of screen of screen , send it. problem view goes far beyond screen's why have scroll view. some suggested ??

How to implement an abstract class in ruby? -

i know there no concept of abstract class in ruby. if @ needs implemented, how go it? tried like... class def self.new raise 'doh! trying write java in ruby!' end end class b < ... ... end but when try instantiate b, internally going call a.new going raise exception. also, modules cannot instantiated cannot inherited too. making new method private not work. pointers? i don't using abstract classes in ruby (there's better way). if think it's best technique situation though, can use following snippet more declarative methods abstract: module abstract def self.included(base) base.extend(classmethods) end module classmethods def abstract_methods(*args) args.each |name| class_eval(<<-end, __file__, __line__) def #{name}(*args) raise notimplementederror.new("you must implement #{name}.") end end end end end end require 'rubygems' ...

.net - Is it possible to add a type to an existing module in c#? -

i have situation need dynamically add types application. basically, what's going on want use ef6, still run dynamic queries against database , return dictionary of key/value pairs. (legacy code, don't ask) i can achieve calling context.database.sqlquery , passing dynamically loaded type, create on fly. i'm using method found online so. private static typebuilder createtypebuilder( string assemblyname, string modulename, string typename) { typebuilder typebuilder = appdomain.currentdomain .definedynamicassembly(new assemblyname(assemblyname), assemblybuilderaccess.run) .definedynamicmodule(modulename) .definetype(typename, typeattributes.public); typebuilder.definedefaultconstructor(methodattributes.public); return typebuilder; } which works great, every time add new type (which may often) loads new dynamic assembly. result in hundreds of assemblies used once. i'm able pull down dynamic assembly using following sta...

javascript - How can i build a circular dialog using css/html -

Image
im building mobile app using html/css display list of contacts. want display shortcut call/email on lines of attached screenshot. thoughts on how css/html ? have tried couple of changes js callbacks havent been represent pop over. after making changes answer on positioning div s in circle , how can it. the idea position div s in circle using trigonometry , javascript. fiddle the function generate(n, r, id) takes 3 arguments: n - number of div s, r - radius , id - main in our case. if intend change variable r other 100 , need change variable adjust make align properly. html: <div id="main"></div> javascript: var theta = []; var setup = function (n, r, id) { var main = document.getelementbyid(id); main.style.width = r * 2 + 'px'; main.style.height = r * 2 + 'px'; var adjust = 4.8; var mainheight = parseint(window.getcomputedstyle(main).height.slice(0, -2)); var circlearray = []; (var = 0;...

sql - Update query: subquery returned more than 1 value -

i'm trying update table ( yahoostockdata) information extracted table ( incomestatement ), depending on date. yahoostockdata contains yahoo prices per day , i'd add number of shares per date depending on actual information available in incomestatement specific date. when running query (without update) numbers want. except, when adding update statement, error message: suquery returned more 1 value . msg 512, level 16, state 1, line 1 subquery returned more 1 value. not permitted when subquery follows =, !=, <, <= , >, >= or when subquery used expression. statement has been terminated. can me solve issue? had @ related questions, not find answer. thank in advance. below code i'm using: update yahoostockdata set numberofshares = (select [weighted average shares outstanding (diluted)] (select *,row_number() on (partition derived_1.morningstarticker, derived_1.[date] order derived_1.asofdate desc) rn (select yahoostockdata....

javascript - jQuery How to detect if file is being currently uploading (event is runing) -

i written code: var fi = self.find('.file'); fi.on('change', function() { if(fi.prop('files').length === 1) { var file = fi.prop('files')[0], name = file.name, ext = name.split('.').pop().tolowercase(), size = (file.size / 1048576).tofixed(2), type = file.type; if($.inarray(ext, ['jpg', 'png', 'gif']) == -1) { return false; } if($.inarray(type, ['image/jpeg', 'image/png', 'image/gif']) == -1) { return false; } if(size > 1.2) { return false; } ajax(createdata(file)); return false; } return false; }); i allowing upload 1 file @ time ( html side, js side , php side of view ), script if user selects bigger size file, lets 2+ mb , fast clicker can select file , creates second event , both files being uploaded server cause...

xml - Android App 50 percent width -

i trying build little android app , need 2 linearlayout side side. (50/50) how looks: http://i.stack.imgur.com/c9ycf.png i try use: android:layout_width="0dp" android:layout_weight="1" didn't work. this xml: <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:id="@+id/part"> <linearlayout android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="9pt" android:layout_alignparenttop="true" android:layout_alignparentleft="true" android:baselinealigned="true" android:background="#ff7f7f7f" android:id="@+id/head"> <textview android:layout_width="wrap_content" android:layout_height="wrap_content" android:textapp...

android - How to get an MenuItem by id -

i have menuitem on res/menu/student_marks.xml file: <menu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" tools:context=".studentmarks" > <item android:id="@+id/action_selected_year" android:title="@string/action_selected_year" android:showasaction="withtext|ifroom" style="@style/apptheme" /> </menu> now need item set title.in specific part of app. can work specific item in method: onoptionsitemselected(menuitem item) the problem need item 'action_selected_year' without of method in part of program. don't have idea how it. menu optionsmenu; @override public boolean oncreateoptionsmenu(menu menu) { getmenuinflater().inflate(r.menu.main, menu); // store menu var when creating options menu optionsmenu = menu; } example: change icon on firs...

python - Save data in datastore -

if have class , list (but in case 30 values): class abc(ndb.model): x = ndb.stringproperty() y = ndb.stringproperty() z = ndb.stringproperty() var = {'x': 'oi', 'y': 'tim', 'z': 'vivo'} and want save values in datastore, there way gave use or while loop when calling class save values without need set 1 value eg: xabc = abc(x = var['x'], y = var['y'], z = var['z']) xabc.put() i see no "list" here described in question, don't know if i've interpreting question correctly. i think you're trying ask: how initialize abc instance, given dictionary dynamic (but limited) set of key/value pairs? if understand intent is, should able simple loop on dictionary's key/value pairs, , use setattr() push keys entity. xabc = abc() key, value in var.iteritems(): setattr(xabc, key, value) alternative approach: can directly use constructor, feeding in keyword arguments...

Linux/Oracle db: how to access website in same subnet using local IP address? -

my oracle 11.2 database schema has scheduled job queries webpage on website every few minutes. database , web servers 2 physical linux machines sit next each other , have local ip addresses 192.168.0.11 (database) , 192.168.0.12 (web server). there rj-45 cable cross-connect directly links 2 servers on same subnet. if enter web address http://xxx.xxx.xxx.xxx/path/to/webpage xxx.xxx.xxx.xxx external ip address, things work fine. things work if replace xxx.xxx.xxx.xxx www.mydomain.com . however, i'm thinking should more efficient if re-write xxx.xxx.xxx.xxx 192.168.0.12 thinking avoid having request go out on internet , come back, rather stay on same subnet webpage (thus saving time , resources). req := utl_http.begin_request('http://192.168.0.12/path/to/webpage'); when try that, 404 error, makes me think didn't right webpage. can keep query on same subnet modifying hosts file or other way? my current hosts file contains alias email server, is: 192.1...

animation - d3.js Saved Transition Error -

i working in d3.js, making chart object. chart has update() method refreshes data, using transition animate change. because have several different objects animate within 1 chart, wanted store transition member of chart's prototype, use transition.each wrapped around transitions allow transitions inherit settings of outer one. using settimeout schedule updates chart on time, becomes animation. the chart supposed show distribution of means of skew population, more , more means taken. here's working version, transition not saved member of chart prototype: http://jsfiddle.net/pmwxcpz7/ now, try modify above code store transition during constructor of chart. when fetch saved transition object , call transition.each() in chart's update method, works first several hundred calls, stops working. here's above code, creation of transition moved constructor: http://jsfiddle.net/whtfny15/1/ when run second version of code, chart stops animating part of way through, , ...

html - Width of table cell with absolute content -

i need table wide it's needed when content absolute , wider whole page. when zoom , top schema div becoming wider, table expand cell. thanks. .toptoolbar,.bottoolbar{ background-color: red; height:100%; } .lefttoolbar,.righttoolbar{ background-color: blue; width:100%; height:100%;; } .mdi{ position:relative; overflow:auto; width:100%; height:100%; background-color: grey; } .schema{ border:10px solid green; position:absolute; top:300px; left:300px; width:600px; height:300px; background-color:white; } .schemabot, .schematop{ border:10px solid green; top:0px; position:absolute; left:600px; width:600px; height:30px; background-color:white; } .schemaleft, .schemaright{ border:10px solid green; position:absolute; top:300px; left:0; width:30px; height:300px; background-color:white; } .tbl tr:first-child td,.tbl tr:last-child td{ position:relative; height:50px; } .tbl tr:nth-child(2) td:first-c...

c++ - Idendify the reason for a 200 ms freezing in a time critical loop -

new description of problem: i run our new data acquisition software in test environment. software has 2 main threads. 1 contains fast loop communicates hardware , pushes data dual buffer. every few seconds, loop freezes 200 ms. did several tests none of them let me figure out software waiting for. since software rather complex , test environment interfere software, need tool/technique test recorder thread waiting while blocked 200 ms. tool useful achieve this? original question: in our data acquisition software, have 2 threads provide main functionality. 1 thread responsible collecting data different sensors , second thread saves data disc in big blocks. data collected in double buffer. typically contains 100000 bytes per item , collects 300 items per second. 1 buffer used write in data collection thread , 1 buffer used read data , save disc in second thread. if data has been read, buffers switched. switch of buffers seems major performance problem. each time buffer switches,...

wordpress - Can server permission rights affect page loading speed -

i changed wp-file permissions 1 tutorial showed ( http://www.smashingmagazine.com/2014/05/08/proper-wordpress-filesystem-permissions-ownerships/ ) now gtmetrix shows site slower. can permissions cause that?

rest - RESTful interface for ECG/EEG sensor data in haskell -

i'm working on project in want display biosensor eeg/ecg data measured portable device (e.g., micro controller wireless data transmission via wifi or bluetooth). purpose, need interface portable device/microcontroller, many or of device seem use restful interfaces , offer sockets. one example of microcontroller wifi "spark.io" , based on cortex m3 , cc3000 wireless controller wifi access on-board. data transferred around 500 1000 float values per second, should arrive @ rest client little delay possible. non-rest approach sockets fit better, still test approach based on restful interface (a tiny argument transferring data via resful interface seems common , has library support). q: question is, best approach performant (in sense of near-realtime) implementation interfaces via rest interface? i sure problem has been solved before, not find paper via google scholar or technical/scientific blog post explains this. link found on "rest hooks" , not sure if...

Android: Setting a button size programatically -

i'm trying make 100x100 px button , add gridlayout on position 3,3 button btn = new button(this); btn.setlayoutparams(new viewgroup.layoutparams(100,100)); gridlayout grid4x4 = (gridlayout)findviewbyid(r.id.grid4x4); //i've narrowed down conclusion line problem: grid4x4.addview(btn,new gridlayout.layoutparams(gridlayout.spec(3),gridlayout.spec(3))); //if use: //grid4x4.addview(btn); button size want it, need on //the 3,3 position of grid. this "almost" works, excepting fact button added bigger 100x100px can see i'm trying fix size want yet reason that's not size get. in res/values/dimens.xml add <dimen name="mybuttonsize">100px</dimen> int size = (int) getresources().getdimension(r.dimen.mybuttonsize); change code to: btn.setmaxwidth(size); btn.setmaxheight(size); btn.setlayoutparams(new viewgroup.layoutparams(size,size));

Changing the pitch of the sound of an HTML5 audio node -

i change pitch of sound file using html 5 audio node. had suggestion use setvelocity property , have found function of panner node have following code in have tried changing call parameters, no discernible result. does have ideas, please? i have folowing code: var gaudiocontext = new audiocontext() var gaudiobuffer; var playaudiofile = function (gaudiobuffer) { var panner = gaudiocontext.createpanner(); gaudiocontext.listener.dopplerfactor = 1000 source.connect(panner); panner.setvelocity(0,2000,0); panner.connect(gainnode); gainnode.connect(gaudiocontext.destination); gainnode.gain.value = 0.5 source.start(0); // play sound }; var loadaudiofile = (function (url) { var request = new xmlhttprequest(); request.open('get', 'sounds/english.wav', true); request.responsetype = 'arraybuffer'; request.onload = function () { gaudiocontext.decodeaudiodata(request.response, functio...

ember.js - EmberJS view is not updating when updating an object in an array -

i have handlebars template have table. <script type="text/x-handlebars" data-template-name="customers"> <table> <tbody> {{#each nomday in allnominationdays}} <tr class="nomdays" {{action "savenomday" nomday on="focusout"}}> <td>{{nomday.confirmedvolume}}</td> <td>{{nomday.variance}}</td> </tr> {{/each}} </tbody> </table> </script> in controller have function call action savenomday defined on tr. update: function() { console.log('not working'); allnominationdays = this.get('allnominationdays'); //this.set('allnominationdays',null); allnominationdays.objectat(0).variance = 75; this.set('allnominationdays',allnominationdays); }, but view not changing when change value of object array. if set object array null template updates , shows no table. not sure breaking bind...

Find the address of an index in an array in C -

given definition of array in c: int a[2][3][4][5], , address of a[0][0][0][0] 1000 address of a[1][1][1][1], assuming int occupies 4 bytes. i got: (3*4*5 * 4bytes) + (4*5 * 4bytes) + (5* 4bytes) + 4bytes = 344 344 + 1000 = 1344 location of a[1][1][1][1] but have no idea if i'm right. math seemed sound me. just print adress of variable see it!: #include <stdio.h> int main() { int a[2][3][4][5]; printf ("size of int %d\n", sizeof(int)); printf("adress of frist element \t%p\n", &a[0][0][0][0]); printf("adress of x element \t\t%p\n", &a[1][1][1][1]); printf ("in decimal: \t\t\t%d\n", &(a[0][0][0][0])); printf ("in decimal: \t\t\t%d\n", &(a[1][1][1][1])); printf("difference between adresses %d", (char *)&a[1][1][1][1] - (char *)&a[0][0][0][0]); return 0; } after can check if right! and see right! it's 334

xml - Haskell: how to write a XSLT transform function without returning IO or arrows -

i want use hxt-xslt transform string containing source xml based on second string containing xslt result xml string. basically, want function of type: transf :: string -> string -> string transf xmlstr xsltstr = ... i searched around, there isn't example xslt in hxt documentation, , closest thing can find code this answer . my problem example , library uses io , arrows heavily. want adapt code , "strip" io , arrow obtain plain transform function returns string or maybe string , don't know arrows. i ask because need parse htmls embedded in csv file. having results in io , arrows makes difficult xslt code work rest of code. based on @chi's comment on origin version of question, looked documentation, , closest thing can following code (by guessing , brute-forcing 3 out of 4 functions in text.xml.hxt.xslt.{compilation,application} ): {-# language arrows, packageimports #-} import "hxt" text.xml.hxt.core import "hxt-...

Getting InstantiationException while using <jsp:useBean> -

can tell me exact meaning of type , class attributes of jsp:usebean tag.? getting exception instantiationexception while using them in application. an extract docs, the jsp:usebean element declares page use bean stored within , accessible specified scope, can application, session, request, or page. if no such bean exists, statement creates bean , stores attribute of scope object . the value of id attribute determines name of bean in scope , identifier used reference bean in el expressions, other jsp elements, , scripting expressions . the value supplied class attribute must qualified class name. note beans cannot in unnamed package. format of value must package-name.class-name. instantiation exception thrown on many scenarios, when dont specify required values attributes of usebean tag. see also a startup tutorial on <jsp:usebean> tag difference between class , beanname attributes of jsp:usebean java.lang.instan...

javascript - How to place a banner on one page which reflect on the rest of the pages automatically? -

i have banner in div , place on home page automatically reflects on rest of pages?? possible ?? without placing code on each page ??. any appreciate :) if you're using php, can write whole banner in html, save .php (e.g. banner.php). somewhere before content of each of pages, use php's include keyword for each of page can write way: <body> <div id='banner'> <?php include "/path/to/banner.php"; ?> </div> <div id='content'> <!-- main content here --> </div> </body>

java - cxf ws-security client does not bind the configuration file -

i try deploy ws-security soap web service using eclipse luna , wildfly 8.1. these sample codes == sei == @webservice @policysets({"ws-sp-ex223_wss11_anonymous_x509_sign_encrypt"}) public interface ihelloworld { @webmethod @webresult public string sayhello(@webparam string name); } == service bean == @webservice @endpointconfig(configfile = "web-inf/jaxws-endpoint-config.xml", configname = "custom ws-security endpoint") public class helloworld implements ihelloworld { @override public string sayhello(string name) { // todo auto-generated method stub return "hello " + name; } } == jaxws-endpoint-config.xml == <jaxws-config xmlns="urn:jboss:jbossws-jaxws-config:4.0" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:javaee="http://java.sun.com/xml/ns/javaee" xsi:schemalocation="urn:jboss:jbossws-jaxws-config:4.0 schema/jbossws-jaxws-con...

Netbeans is there a way to manualy complile all .less files in one directory (which has subdirectories) -

i have dir lots of subdirs , inside .less files, until today settings "compile on save" if changed .less files netbeans automatically compile them on save, i'm looking functionality recompile .less files in dir if weren't changed, there way that? you can use grunt task (and invoke task ide assuming have 8.0 , higher) or maybe try disable less compilation in netbeans, close project properties dialog , enable again. trigger compilation.

vb.net - Copy a DataGridView -

i'm trying take copy of datagridview. public sub copydataview(byval ingrid datagridview, byval inprinthiddencols boolean) datagridview1 = ingrid i alter configuration of datagridview1 do: datagridview1.refresh() datagridview1.visible = true the problem i'm having done datagridview1 , original grid changed , refreshed. despite fact original grid passed byval. i've tried processing passed grid, column, column, row row, error "provided column belongs datagridview control" the datagridview1 initialized cursor.current = cursors.waitcursor try datagridview1.columns.clear() datagridview1.rows.clear() datagridview1.autosize = true datagridview1.autogeneratecolumns = false datagridview1.rowheadersvisible = false each col datagridviewcolumn in ingrid.columns if col.width = 0 or _ col.displayed = false , _ not (inprin...

java - CycleDetectedException in maven -

is there way avoid cycledetectedexception when compiling modules? explain have 6 modules: f ==> ==> b ==> c ==> d ==> e i want f ==> c , having same dependency tree used scope provided or runtime did not fixed. help please

ios - How to get one record per section when using NSFetchedResultsController -

i work on ios app uses core data , want display entity using uitableview. for i'm using nsfetchedresultscontroller. thing trying achieve display each record in it's section. want 1 row per section. the methods struggling : - (nsinteger)numberofsectionsintableview:(uitableview *)tableview and - (nsinteger)tableview:(uitableview *)tableview numberofrowsinsection:(nsinteger)section because want have piece of code when computing numberofsectionsintableview: { id <nsfetchedresultssectioninfo> sectioninfo = [[self.fetchedresultscontroller sections] objectatindex:section]; return [sectioninfo numberofobjects]; } and want have return 1 when computing numberofrowsinsection (and can't pass indexpath.section to numberofsectionsintableview ). approach in problem/situation? thank you. well, obviously, have section have object : - (nsinteger)numberofsectionsintableview:(uitableview *)tableview { // return number of sections. return...

postgresql - Tablefunc in Redshift to pivot table not supported? -

i trying pivot table in redshift, using postgresql. answer instructive: https://stackoverflow.com/a/11751905/3063339 however, when run the create extension tablefunc; command error: syntax error @ or near "extension" does redshift not support syntax above, or tablefunc , or neither? if so, there redshift functions act workaround? aware table can pivoted basic postgresql commands sum(case ...) etc. these not scale large tables though. many thanks. create extension introduced postgres 9.1. amazon redshift based on postgresql 8.0.2. selected features later versions implemented. i not seem redshift supports extension tablefunc at all . you'll have use case statements emulate functionality. here related post on aws (that found in comment).

javascript - D3.js time scale: nicely-spaced ticks at month intervals? -

i'm using d3.js create simple bar graphs, , using d3.time.scale() x-axis. but, stumbled upon 1 irregularity (or seems me, although of course, i'm wrong :p) when generate scale ticks @ monthly intervals, difference between ticks not equal. scalex = d3.time.scale() .range([0, 1000]) .domain([new date('2014-01'), new date('2014-12')]) scalex(new date("2014-01")) // 0 scalex(new date("2014-02")) // 9.28... (diff ~ 9.3) scalex(new date("2014-03")) // 17.66... (diff ~ 8.4) scalex(new date("2014-04")) // 26.94... (diff ~ 9.3) this causes bars in graph unevenly spaced, leading ugly graphs... what's correct way evenly space out bars months ticks? realize there possibility use ordinal scale this, doesn't feel right, ordinal scale not draw ticks months don't have data. edit: little clarification on question: since programmers, asked "correct way" make ticks evenly spaced out. want as...

parameters - Update Access 2010 database in C# -

i'm going crazy that, i'm trying save changes in table in access 2010 .accdb database c# i have method: using (oledbconnection conn = new oledbconnection(@"provider=microsoft.ace.oledb.12.0;data source=" + frmmain.dbpath + "; persist security info=false;")) { conn.open(); using (oledbtransaction tx = conn.begintransaction()) { using (oledbcommand cmd = new oledbcommand( "update ricette set " + "ricette.resinaureicatotale = @resinaureicatotale, " + "ricette.resinaureicaparziale = @resinaureicaparziale, " + "ricette.resinamelaminicatotale = @resinamelaminicatotale, " + "ricette.resinamelaminicaparziale = @resinamelaminicaparziale, " + "ricette.acquatotale = @acquatotale, " + "ricette.acquaparziale = @acquaparziale, " + ...

c++ - Boost logging in 2 files with rotation -

i using boost storing logs in files. fine, rotation works, there possibility rotate logs in 2 files? have 2 files of maximum 250 mb size , if 1 filled, stores logs in other file ad if second filled, first 1 going cleaned , new logs going stored there... , on. possible via boost? i have see there sink->locked_backend()->set_close_handler(&foo); , isn't there possibility use function delete old log file? (until have not managed find it) interesting question. it looks boost devs have decided easier implement separate garbage collect if will rm -v $(ls -t mylog_*.log | tail -n -2)

Visual Studio Solution Explorer not showing files and folders -

Image
suddenly solution tab stopped working on visual studio 2013. existing project or brand new project not show files , folders in solution explorer. (file attached) i tried reset settings, restarted pc did not work. http://msdn.microsoft.com/en-us/library/ms247075(v=vs.100).aspx i did not installed new extensions working ever had while. is there else can do? update; i getting weird message when click options icon: check out: http://www.hjerpbakk.com/blog/2014/7/25/no-content-in-solution-explorer-using-visual-studio-2013 to quote... "this issue because of mef cache corruption. installing feedback extension (or installing extension) invalidate cache causing vs rebuild it." link bug report: https://connect.microsoft.com/visualstudio/feedback/details/794111/no-exports-were-found-that-match-the-constraint-contract-name

android - Use MediaScannerConnection scanFile To Scan Downloaded Image File -

i working on app in save image(s) directory images wont show in gallery until restart phone. here's code snippet public class savetask extends asynctask<string , string , string> { private context context; private progressdialog pdialog; string image_url; url myfileurl; string myfileurl1; bitmap bmimg = null; file file ; public savetask(context context) { this.context = context; } @override protected void onpreexecute() { // todo auto-generated method stub super.onpreexecute(); pdialog = new progressdialog(context); pdialog.setmessage("downloading image ..."); pdialog.setindeterminate(false); pdialog.setcancelable(false); pdialog.show(); } @override prot...

excel vba - Get reference to next visible cell in autofiltered table -

i have userform sits on top of spreadsheet , displays information row containing selected cell. buttons on form allow user move up/down spreadsheet row row. example, when "next record" button clicked, code executed like: cells(activecell.row + 1, activecell.column).select loadvalues i work if user filters data , loads form. however, using above code, wants loop through cells, not ones still visible after filtering. i've seen solutions looping through visible cells, e.g., for each viscell in rng.specialcells(xlcelltypevisible) ... next viscell so there seems there should better, more direct way looping through rows until next 1 .hidden = false can't seem figure out how reference "the next visible cell" in order select it. any pointers appreciated. thanks. here 1 method using simple loop until next row down visible. dim rng range set rng = activecell dim n long: n = 1 until rng.offset(n, 1).rows.hidden = false n = n + 1...

c++ - Reading a 2D Array from the console -

i'm trying read 2-dimensional array console code wrong , reads twice last line, doing wrong?? example input: 1 01 10 output: 10 10 int n; cin>>n; char *a=new char[n,n]; for(int i=0; i<n; i++) { for(int j=0; j<n; j++) { cin>>a[i,j]; } cin.ignore(); } looking @ code take trying make 2d array dynamic size, syntax wrong declaring populating array. think of 2d array array of pointers array. question has been asked , answered: how declare 2d array in c++ using new?

java ee - losing conection to EJB after restart -

i have app connecting ejb retrieve data. ejb in separate ear. app using delegate-singleton pattern connection ejb. problem is, ejb gets redeployed quite because it's still being developed , every time happens app ends disconnecting , unable reconnect when ejb comes online because singleton's getinstance method keeps returning empty remote object reference , connection cannot reestablished, have redeploy client app able reconnect. way keep happening, doesn't involve doing lookups on every request? public class delegate { ... private datastoreservice getdatastoreserviceinterface { servicelocator servicelocator = servicelocator.getinstance(); return servicelocator.getdatastoreservice(); } public data getdata(){ datastoreservice datastoreservice = getdatastoreserviceinterface(); return datastoreservice.getdata(); } } public class servicelocator{ private static servicelocator instance = null; private datastoreservice ...

ruby on rails - Running unicorn as a service on centos to work with capistrano -

i trying use capistrano 3 deployment, using nginx-unicorn on centos 6.5. able run cap production deploy, , ssh server , restart manually. i tried include gem - https://github.com/kalys/capistrano-nginx-unicorn - automate restarting of unicorn , nginx, fails when attempting restart unicorn service, running command /usr/bin/env sudo service unicorn_app_name_production stop *service not exist* i checked services when unicorn running manually , not in there, start command unicorn_rails -c config/unicorn.rb -e production -d i setup server using tutorial - https://www.digitalocean.com/community/tutorials/how-to-deploy-rails-apps-using-unicorn-and-nginx-on-centos-6-5 any help? you can check this issue on similar gem (capistrano-unicorn-nginx improved fork of kalys/capistrano-nginx-unicorn). disclaimer: maintain gem. the core issue both gems tested work on ubuntu (not on centos) using ubuntu specifics (directories etc). i'd suggest forking gem you're usin...

Trying to access a bash array via function results in ${1[@]}: bad substitution -

there's not code below results in bad substitution. #!/bin/bash numbers=(0 1 2 3 4 5 6 7 8 9) charslc=(a b c d e f g h j) charsuc=(a b c d e f g h j) show () { # value of var held in $1 in "${1[@]}"; echo $i done } # # processing happens here resulting in # var=numbers or # var=charslc or # var=charsuc # var=numbers # simulating process mentioned above show $var question: how can fixed while ideally sticking type of approach? define function as: show() { arr=$1[@] in "${!arr}"; echo "$i" done } and call as: numbers=(0 1 2 3 4 5 6 7 8 9) var=numbers show "$var"

java - How to filter database output? (android PHP) -

i building mobile app in user logs in , outputs contents of database table named "announcements". what i'm trying filter out these output based on "department" column "accounts" table in users stored. the "announcements" table has column named "receiver". the contents show if "department" column of user logged in has same value "receiver column" of "announcements" column or if value of receiver "all". how do this? my php script <?php $host="localhost"; //replace database hostname $username="root"; //replace database username $password=""; //replace database password $db_name="sunshinedb"; //replace database name $con=mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select db"); $sql = "select * announ...