Posts

Showing posts from February, 2013

javascript - Convert MongoDB query result into JSONArray -

i have mongodb query via mongoose , result is: [ { "tablename": "name1" }, { "tablename": "name2" } ] but need jsonarray : { "tablename": [ "name1", "name2" ] } is there easy way convert? the aggregation framework can create desired result you. consider $group , $push accumulator operators follows: db.collection.aggregate([ { "$group": { "_id": null, "tablename": { "$push": "$tablename" } } }, { "$project": { "_id": 0, "tablename": 1 } } ]) sample output: /* 0 */ { "result" : [ { "tablename" : [ "name1", "name2" ] } ], "ok"

I am trying to debug my PowerShell but I cannot get anything to output -

i have script here: write-host "checking files" #to make more dynamical can save on 1 file #all file names including extension in different lines. #for example on path c:\filestowatch\watcher.txt #$filestowatch=get-content c:\filestowatch\watcher.txt #$filestowatch="felicio.txt","marcos.txt" $userfiles=dir c:\g\user\less\ $adminfiles=dir c:\g\admin\less\ #optionally instead of use if approach can #$adminfiles=dir c:\gt\admin\src\admin\wwwroot\content\less|? {$filestowatch -contains $_.name} #$userfiles=dir c:\gt\user-staging\src\user-staging\wwwroot\content\less|? {$filestowatch -contains $_.name} #loading in above manner first if statement on code bellow can removed because #we make sure $userfiles , $adminfiles have correct file monitor foreach($userfile in $userfiles) { if($filestowatch -contains $userfile.name) { $exactadminfile= $adminfiles | ? {$_.name -eq $userfile.name} |select -first 1 #my suggestion validate if g

java - Having main method in an abstract class -

i know it's legal have main method in abstract class, because eclipse allows me following , run class java application. make sense this? is there real world scenario 1 need have main method in abstract class? public abstract class automobile { public boolean poweron() { // generic implementation powering on automobile return true; } public void move() { // generic implementation move } public void changedirection(string newdir) { // generic implementation changing direction } public abstract void accelerate(integer changeinspeed); public abstract integer refuel(integer inputfuel); public static void main(string[] args) { system.out.println("i main method inside abstract automobile class"); } } no, not really. trying create class hierarchy different classes share same main method doesn't seem useful. see example: public abstract class { public s

CSS - Best practice for larger margin between all elements but smaller between same elements -

let's want have 2em vertical distance between elements (p, blockquote, dl, form, ol, ul, pre, table, etc) on page. so throw margin-bottom:2em; on necessary elements. great. then see several p tags, come right after each other, far apart, , i'd them have 1.5em, while keeping 2em between other elements. what's elegant way it, while sticking we're-going-to-govern-margins-by-only-using-the-bottom-margin concept? the selector p+p apply bottom margin in p "list" except first one. note put 1.5 margin on last p , should not have small margin, larger 2em bottom margin. i tried :last-child selector, putting small margin value on bottom of p tags first, using p:last-child set last paragraph larger 2em bottom margin. sounded great, didn't make change last p in grouping. note switch governing margin top margin, in case p+p elegant control spacing between p tags. however, have spacing @ top (of other elements h1, etc) , have over

xslt - How to display appropriate language labels for items that have non-english version -

i have item uri http://hdl.handle.net/10862/717 in our local language has english version: http://hdl.handle.net/10862/152 . <dim:field element="relation" qualifier="hasversion" language="en" mdschema="dc">http://hdl.handle.net/10862/152</dim:field> my xsl template below: <xsl:template name="itemsummaryview-dim-hasversion"> <xsl:if test="dim:field[@element='relation' , @qualifier='hasversion' , descendant::text()]"> <div class="simple-item-view-uri item-page-field-wrapper table"> <h5><i18n:text>xmlui.dri2xhtml.mets-1.0.item-hasversion</i18n:text></h5> <span> <xsl:for-each select="dim:field[@element='relation' , @qualifier='hasversion']"> <a> <xsl:attribute name="href">

jquery - Hide Asp:DropDownList based on select dropdownlist values? -

i'm trying hide 2 dropdownlists based on value "select" dropdownlist. ddlists want hide asp:dropdownlists. select class looks this: <select class="form-control" id="number_rooms"> <option>1</option> <option>2</option> </select> when value 1, dropdownlists should hidden. when value 2, users should see them. code: <asp:dropdownlist id="droplist1" cssclass="form-control" runat="server"> <asp:listitem>2</asp:listitem> <asp:listitem>1</asp:listitem> </asp:dropdownlist> <asp:dropdownlist id="droplist2" cssclass="form-control" runat="server"> <asp:listitem>2</asp:listitem> <asp:listitem>1</asp:listitem> </asp:dropdownlist> have tried jquery former posts, none seem work.. jquery code:

c# - Click a listbox item open WebBrowser -

in webbrowser control have listbox. data on html page has loaded listbox, how can click on each item in listbox , open html page corresponds? (html pages have been put in debug folder of project). can use selectedindexchanged event or not? thank you! in selectedindexchanged event, newly selected value of listbox , open url... system.diagnostic.process.start(urlfromlistbox);

python - Removing Flask session -

in app after logging in, set: session['venue_id'] = true in javascript connect websocket : var socket = io.connect('http://my.ip.address.' + ':' + '80' + namespace); this triggers following code on server: @socketio.on('connect', namespace='/test') def test_connect(): if session.get('venue_id'): session.pop('venue_id', none) else: request.namespace.disconnect() following make calls api check: if session.get('venue_id') however, goes through fine. have thought these requests not have gone through if statement venue_id had been popped ? i read answer here: python + flask - removing key session fast but confused purpose of session.pop('venue_id', none) is? any clearing appreciated. you need send (non-websocket) response alter session. popping value nothing, browser doesn't update it's side , sends data again next request. right now,

php - .htaccess Pretty URL rewrite inside a folder -

i trying rewrite 1 of urls pretty urls can't seem figure out. here i've tried current folder layout -index.php -/instagram -index.php -.htaccess inside .htaccess have put code rewriteengine on rewriterule ^instagram/([^/]*)$ /instagram/?username=$1 [l] my goal turn url http://example.com/instagram/?username=test1234 into url http://example.com/instagram/test1234 however, when go second url in browser gives 404 not found error. idea on how fix this? place code inside /instagram/.htaccess : directoryindex index.php rewriteengine on rewritebase /instagram/ rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^([^/]+)/?$ index.php?username=$1 [l,qsa]

excel - How can I make a part of a formula to vary? -

i trying make part of code change while worksheet change, not work. changing 1 worksheet other ok, changing integer not work in code. create j integer grow in 1 unit worksheet change. therefore, graph , shapes based on sheet (dados) has data in different lines provide information each worksheet. sub relatorio() dim ws worksheet, gi integer, gf integer, j integer j = 0 each ws in activeworkbook.worksheets ws j = j + 1 if .name = "brasil" = (8 * j) + 4 'the 8 amount of lines below need catch , 4 because data starts on line 4. gi = (13 * j) + 271 gf = (13 * j) + 283 end if if .name <> "dados" .shapes("tri") .formula = "=dados!a2" .shaperange.textframe2.textrange.font.name = "calibri" .shaperange.textframe2.textrange.font.size = 9 end it not work following step on. please me

c# - WP8.1 Draw XAML Line On MapControl Between Two Points -

i writing application windows phone 8.1, part of app requires line drawn between 2 locations on map. have map set , code calculates 2 locations in place , working. i looking simple tutorial or guide drawing line between 2 geopositions on mapcontrol. i understand how draw ellipse specific point, couldn't find drawing straight line between 2 points. during research did come across library called wpwinnlmaps, couldn't find way implement achieve want. please let me know if further information/context required , appreciated, have been stuck on problem while now. thanks, matt i read polylines, tryed them once on android, should work in windows phone, here documentation. https://msdn.microsoft.com/en-us/library/ee681899.aspx hope works you!

What is DataContext in XAML? -

please describe datacontext in xaml , when use , relationship between {binding} syntax. (with example) (in simple terms) thank lot. data contexts best described here . put datacontext data accessible (aka within scope of) element. example textbox might have datacontext set someobject, if bind using binding this. <textbox datacontext={binding path=someobject} text={binding path=mystring} /> the textbox have datacontext containing values in someobject. binding performed on element (or nested elements) within scope. binding on 'text' dependency property try find value in someobject.mystring. its important note data context passed down child elements. if datacontext set on parent , if not explicitly override on child elements children have same data context.

c - runs fine on IDE but gives Runtime Error(SIGSEGV) on submitting -

https://www.codechef.com/problems/cleanup/ after long , successful day of preparing food banquet, time clean up. there list of n jobs before kitchen can closed night. these jobs indexed 1 n. most of cooks have left , chef , assistant left clean up. thankfully, of cooks took care of of jobs before left subset of n jobs remain. chef , assistant divide remaining jobs in following manner. chef takes unfinished job least index, assistant takes unfinished job second least index, chef takes unfinished job third least index, etc. is, if unfinished jobs listed in increasing order of index chef take every other 1 starting first job in list , assistant take every other 1 starting second job on in list. the cooks logged jobs finished before left. unfortunately, these jobs not recorded in particular order. given unsorted list of finished jobs, determine jobs chef must complete , jobs assitant must complete before closing kitchen evening. input the first line contains single integer t ≤

java - Spring enums in a map -

i have 2 enumerateds: public enum 1 implements representable{ 1 } public enum 2 implements representable{ 2 } now, need declare following spring-bean: <bean id="listgeneratorcontainer" class="pack.age.container> <property name="generators"> <map key-type="pack.age.representable"> <!-- how specuify type? --> <entry key="one" value="1"/> <entry key="two" value="2"/> </map> </property> </bean> where package pack.age; public class container{ private map<representable, interger> generators //get, set, staff } is possible tell spring inject enums of different types? in case of single enum that's clear. it's not working now: java.lang.illegalargumentexception: cannot convert value of type [java.lang.string] required type [pack.age.representable]: no matching editors or

listener - Inconsistent peer connection between Android Phone and Watch -

i want add watch module existing android project. line in phone project androidmanifest: <application android:name="com.xxx.xx.core.xx" android:icon="@drawable/launcher_icon" android:label="@string/app_name"> <receiver android:name="com.google.android.gcm.gcmbroadcastreceiver" android:permission="com.google.android.c2dm.permission.send"> <intent-filter> <action android:name="com.google.android.c2dm.intent.receive" /> <action android:name="com.google.android.c2dm.intent.registration" /> <category android:name="com.xx.xx" /> </intent-filter> </receiver> .... this onpeerconnected method: @override public void onpeerconnected(node peer) { super.onpeerconnected(peer); toast.maketext(this, "peer connected phone", toast.length_long).show(); }

java - How to sort List of Map String in ascending order -

i have list of hashmap , want sort in ascending order in java. i using custom comparator implement logic, failing. grouping list based on map keys. not sorting list entirely. my code looks like- public class listmap { public static void main(string[] args) { calendar cal = calendar.getinstance(); list<hashmap<string, string>> list = new arraylist<>(); (int = 0; < 20; i++) { int value = randint(1, 20); long timeinmillis = cal.gettimeinmillis(); hashmap<string, string> mp = new hashmap<>(); mp.put("" + value, "values" + value + ":" + timeinmillis); list.add(mp); } collections.sort(list, new comparator<map<string, string>>() { @override public int compare(map<string, string> map1, map<string, string> map2) { string val1 = "&q

pandas - allowing multiple inputs to python subprocess -

i have near-identical problem 1 asked several years ago : python subprocess 2 inputs received 1 answer no implemention. i'm hoping repost may clear things me , others. as in above, use subprocess wrap command-line tool takes multiple inputs. in particular, want avoid writing input files disk, rather use e.g. named pipes, alluded in above. should read "learn how to" admittedly have never tried using named pipes before. i'll further state inputs have 2 pandas dataframes, , i'd 1 output. the generic command-line implementation: /usr/local/bin/my_command inputfilea.csv inputfileb.csv -o outputfile my current implementation, predictably, doesn't work. don't see how/when dataframes sent command process through named pipes, , i'd appreciate help! import os import stringio import subprocess import pandas pd dfa = pd.dataframe([[1,2,3],[3,4,5]], columns=["a","b","c"]) dfb = pd.dataframe([[5,6,7],[6,7,8]], columns=[&

javascript - it is possible to find out on which line of the input field is not a match per regex? -

here regex /([0-9]{2}\/[0-9]{2})/gm and when in input field this 09/09 03/65 0938 05/37 i want alert this: there error in third line it possible somehow? split value new line , check each line against regex pattern. for example: var regex = /^[0-9]{2}\/[0-9]{2}$/; var lines = val.split(/\r?\n/); for(var = 0; i<lines.length ; i++){ if (lines[i].match(regex) == null) { alert('there error in ' + (i + 1) + ' line'); break; } } note: use ^ (beginning of line) , $ (end of line) match whole line.

javascript - Invalid value for <circle> attribute r="NaN" in D3 scatterplot code -

i getting nan error on r value in d3 scatterplot. console error: error: invalid value attribute r="nan" from section of code: g.selectall(".response") .attr("r", function(d){ return responsescale(d.responses); }) .attr("cx", function(d){ return x(d.age); }) .attr("cy", function(d){ return y(d.value); }) here how scale set up: var responsescale = d3.scale.linear() .domain(d3.extent(data, function(d){ return d.responses; })) .range(2, 15); here sample of data: var data = [ {glazed: 3.14, jelly: 4.43, powdered: 2.43, sprinkles: 3.86, age: 18, responses: 7}, {glazed: 3.00, jelly: 3.67, powdered: 2.67, sprinkles: 4.00, age: 19, responses: 3}, {glazed: 2.00, jelly: 4.00, powdered: 2.33, sprinkles: 4.33, age: 20, responses: 3}, i have tried putting plus sign in front of d.responses , using parsefloat(

labels - Create a factor with more levels as actual used by default in R -

i wrote function in r tabulate patient characteristics. if have tabulate nominal variable works fine, if there no nas different categories. for example: i tabulate nyha class @ baseline studyarm. nyha class has categories "no", "nyha i", "nyha ii", "nyha iii", "nyha iv", , maybe "nyha unknown". in data nyha class known (the category "nyha unknown" missing). in patient characteristic table (pct) want line category "nyha unknown" well. this code: testvarlab = c("no hi","nyha i","nyha ii","nyha iii","nyha iv","nyha unknown") testvarf<-factor(testvar,labels=testvarlab[1:5]);class(testvarf);table(testvarf) works fine, have code labels index (here [1:5]). category "nyha unknown" missing. it can added afterwards: levels(testvarf)<-testvarlab this solution not useful because of hard indexed labels. use pct check data d

javascript - Overlapping masonry divs with instafeed and twitterFetcher scripts -

i have small problem 2 masonry blocks overlapping on load. both blocks contain empty divs use scripts add content. 1 instafeed display latest instagram image , other displays latest tweet. if resize window stack nicely. i've tried using .imagesloaded method below doesn't change anything. , tweet block text anyway. <script> $(document).ready( function() { var $container = $('#container').imagesloaded( function() { $container.masonry({ "gutter": ".gutter-sizer", "itemselector": ".item", "stamp": ".stamp" }); }); }); </script> if use following fixes browsers except ie9: <script> $(window).load(function(){ $('#container').masonry({ "gutter": ".gutter-sizer", "itemselector": ".item", "stamp": ".stamp" }); }); </script>

c# memcmp image compare error -

im trying compare 2 smalls blocks of image using memcmp method. saw answer what fastest way can compare 2 equal-size bitmaps determine whether identical? , tried implement in project: private void form1_load(object sender, eventargs e) { bitmap prev, curr; prev = (bitmap) image.fromfile(@"c:\users\public\desktop\b.png"); curr = (bitmap)image.fromfile(@"c:\users\public\desktop\b.png"); messagebox.show(comparememcmp(prev, curr).tostring()); } this method- [dllimport("msvcrt.dll")] private static extern int memcmp(intptr b1, intptr b2, long count); public static bool comparememcmp(bitmap b1, bitmap b2) { if ((b1 == null) != (b2 == null)) return false; if (b1.size != b2.size) return false; var bd1 = b1.lockbits(new rectangle(new point(0, 0), b1.size), imagelockmode.readonly, pixelformat.format32bppargb); var bd2 = b2.lockbits(new rectangle(new point(0, 0), b2.size), imagelockmode.readonly, pixelformat.format32b

sift - How to use SiftDescriptorExtractor in openCV 3.0.0 -

i use siftdescriptorextractor in such use : siftdescriptorextractor detector; and try type bellow: #include <opencv2\nonfree\features2d.hpp> #include <features2d.hpp> #include <opencv2\features2d\features2d.hpp> #include <opencv2/features2d.hpp> but non of them work properly. know right way use siftdescriptorextractor in opencv 3.0.0 ? the standard opencv 3.0 builds no have sift included. need build , install contrib module use sift. see opencv_contrib . please take notice of licensing terms of sift algorithm.

windows - c++ GetKeyState() some Key codes not working -

hi creating game in c++ on windows7 , have came on strange problem: i use getkeystate retrieving key states , has worked fine till now. i have mapped few keys: (inputkey integer) const static inputkey key_w = 87; const static inputkey key_s = 83; const static inputkey key_a = 65; const static inputkey key_d = 68; const static inputkey key_i = 73; // 1 not working const static inputkey key_v = 86; and cant key "i" working returns not pressed 0x0000 here function: inline static bool iskeypressed(int keycode){ return (getkeystate(keycode) & 0x8000); } does know cause. have nothing related key in window messages loop... here window loop: void window::run() { msg msg; displaystate = 1; while(peekmessage(&msg, 0, 0, 0, pm_remove)) { translatemessage(&msg); dispatchmessage(&msg); } } lresult callback window::wndproc(hwnd hwnd, uint message, wparam wparam, lparam lparam) { w

html - Image on hover overlaps image on the left but not on the right -

i'm trying scale size of image on hover. image part of gallery there other images on left , right. problem image on hover overlaps on left image not on right. i saw this question identical problem , tried fix. started working on firefox still no change in chrome. what's wrong here? html <div class="row" id="attractions"> <div class="container" style="margin-bottom: 20px;"> <div class="attractions-title"> <h1 class="text-center text-danger">gallery</h1> </div> <div class="gallery"> <div class="gallery-item wow fadein hidden-xs" data-wow-delay="0.4s"> <img src="img/attractions/adventure-cove.jpg" alt="adventure cove waterpark"> <h4 class="text-center">adventure cove waterpark</h4> </div>

jquery - Kendo Gauge with multiple pointers angular -

i have kendo radial gauge 3 pointers. defined them in same way example ( http://demos.telerik.com/kendo-ui/radial-gauge/multiple-pointers ). problem can't figure out how assign values 3 pointers (it doesn't have in 1 call). way in jquery .allvalues function , can't figure out or how in angular. here's tried: $scope.mygauge[1] = 50; $scope.mygauge = [20, 50, 80]; they both seem change first pointer , not other two. tried breaks angular code. $scope.mygauge.pointers[1].value(50); $scope.mygauge.data("kendoradialgauge).pointers[1].value(50); i gave gauge id of "radial1" , able set each pointer way. still using jquery , makes ng-model useless, works @ least. if has answer of how angular feel free share otherwise now $("#radial1").data("kendoradialgauge").pointers[1].value(50)

c# - illegal access to loading collection -

i know there many answers this.but not getting want missing me.i have tried lot don't find missing.getting 'illegal access loading collection ' even suggesstions wil appricated nhibernate .hbm <?xml version="1.0" encoding="utf-8" ?> <hibernate-mapping namespace="emsmodels" assembly="emsmodels" xmlns="urn:nhibernate-mapping-2.2"> <class name="reimbursement" table="reimbursement"> <id name="id" column="reimbursementid" type="int"> <generator class="native" /> </id> <property name="employeeid" type="int" /> <property name="submissiondate" type="datetime" /> <property name="description" type="string" length="500" /> <property name="isactive" type="bool" /> <property name=&

visual studio 2013 - Suppress rsOverlappingReportItems warning in RDLC files -

is there way suppress such warnings? either single file or whole project. the message comes out this: warning x text box ‘’ , text box ‘’ overlap. overlapping report items not supported in renderers. please check positions ( top, left ) , sizes ( width, height ) properties , adjust properties fix warnings. example: textbox1 => left = 1in, width = 2in textbox2 => left = 2.8in, width = 5in //overlapping fix: textbox2 => left = textbox1.left + textbox1.width + <small space> textbox2 => left = 1in + 2in + 0.00200in //fix i did , build warnings gone. may useful.

exception with Hive long create table statement -

i have "very long" create external table" statement try run in hive (200+ columns) end error message. error while processing statement: failed: execution error, return code 1 org.apache.hadoop.hive.ql.exec.ddltask. metaexception(message:for direct metastore db connections, don't support retries @ client level.) it's suppose create external table on populated hbase table. if reduce number of column in hive statement works. so max number of column?, connection timeout? , lenght of statement? please share thought. regards, breach not sure if number of variables real problem given limited information provided, post should able check if number of variables problem. creating hive table ~40k columns

JQuery check if url exist No 'Access-Control-Allow-Origin' -

i'm trying check if url exist using jquery , following checking url in jquery/javascript however getting xmlhttprequest cannot load http://10.16.20.22:8080/xxx . no 'access-control-allow- origin' header present on requested resource. origin ' http://localhost ' therefore not allowed access. my question how can check if url exist? here datatype: jsonp cross-domain request , means request different domain datatype: json same domain-same origin request. function urlexists(url, successcallback) { $.ajax({ url: url, datatype: "jsonp", statuscode: { 200: function(response) { console.log('status 200'); successcallback(); }, 404: function(response) { console.log('status 404 '); } } }); } urlexists("http://google.com", function() { console.log('side exists got executed'); }); codepen link http://codepen.io/anon/pen/waevmv

sql - numbering partitions based on changing dimensions -

i'm having trouble creating right partitions within data. here's example of data looks like, complete desired output: customer contract type1 type2 partition 100 1 1 100 2 1 100 3 b 2 100 4 b 2 100 5 b 2 100 6 3 100 7 3 100 8 c 4 100 9 c 4 the variable i'm trying construct last one, called partition. problem have now, when using dense_rank , contracts 1 , 2 grouped contracts 6 , 7: select t1.* , dense_rank() on (order customer, type1, type2) partition table1 t1 what can use generate desired output (on large dataset)? if understand correctly, want adjacent groups of rows, "adjacent" based on contract . you can using difference of row_number() values. difference constant, when values

Opening yelp deep link from android app -

i using following code , not opening yelp app: string uristring = "yelp://biz/" + "some name"; startactivity(new intent(intent.action_view, uri.parse(uristring))); instead says could not execute method of activity ! any pointers? the answer being, call http url of yelp page, ask whether open in yelp app if pre-installed. else , open in browser.

c# - Can't route to methods in BaseController when Derived is using ODataRoute -

i'm having problems routing basecontroller controllers define [odataroute] s. get ~/odata/foos works get ~/odata/foos(1) works get ~/odata/foos(1)/bars works get ~/odata/bars 404 not found basecontroller public abstract class basecontroller<t> : odatacontroller t : class { protected igenericrepository<t> repository; public basecontroller(igenericrepository<t> repository) { repository = repository; } [enablequery] public ihttpactionresult get() // <---------- problem { return ok(repository.asqueryable()); } [enablequery] public ihttpactionresult get(int key) // works { var entity = repository.getbykey(key); return ok(entity); } } controllers public class fooscontroller : basecontroller<foo> { public fooscontroller(igenericrepository<foo> repository) : base(repository) { } // can route base without problems // both base.g

actionscript 3 - Action Script 3 NumericStepper validation for empty value -

i have simple numericstepper looks this: <mx:numericstepper id="nsport" minimum="0" maximum="65535" stepsize="1" value="{port_default}"/> i wrote validator (which doesn't work expect): <mx:numbervalidator required="true" source="{nsport}" property="value"/> however, every time don't enter numericstepper passes zero, not null or else, is...well...a valid value. suspect done on purpose. so, how can make blank value @ numbericstepper invalid? please note i'm restricted ver.3 of action script. example code base https://flexscript.wordpress.com/2008/09/22/flex-creating-custom-validators/ little modification: package flexscript { import mx.validators.validationresult; import mx.validators.validator; //class should extend mx.validators.validator public class numericsteppervalidator extends validator { public function numericsteppervalidator()

php - how to get data weekly. Only till Monday to Next Sunday -

i have coded program in can data of last 7 days. want data should visible of last week , week starts monday , ends @ sunday. on monday next week starts. want if today wednesday , if click on week report. should data till last monday . (wednesday, tuesday, monday) system counts complete 7 days. here codes. date_default_timezone_set("est"); $wdate = date('y-m-d'); $wdate_to = $wdate; $wdate_to = strtotime("-7 days", strtotime($wdate_to)); //-7 days last week. -30 last week $wdate_to = date("y-m-d", $wdate_to); $wget_req = "select * `requests` `assign_date` between '$wdate_to' , '$wdate' , `assigned`=1"; $result = mysqli_query($dbc, $wget_req); while ($res = mysqli_fetch_assoc($result)){ $driver_id = $res['assigned_driver_id']; $req_id = $res['req_id']; $req_title = $res['request_title']; $req_price = $res['price']; $req_time = $res['request_time']; $re

c# - Get an object from multiple List<T> lists with a specific id -

in c# , if have multiple list<t> lists, each item in list inherits interface has id property, how best way retrieve object has specific id ? all ids unique , lists stored in 1 object. i thinking of writing find piece of code, each list, , if object returned not null, object returned object id. is there better way this? just inform, question how find object in multiple lists, rather code find object in single list. you can create list of lists, , search using linq's selectmany : here example setup: interface iid { int id {get;} } class : iid { public int id {get;set;} public override string tostring() { return "a"+id; } } class b : iid { public int id {get;set;} public override string tostring() { return "b"+id; } } iid common interface implemented a , b . can this: var = new list<a> {new {id=5}, new {id=6}}; var b = new list<b> {new b {id=7}, new b {id=8}}; var = new

sql - Join not fetching data correctlly -

i have written procedure below lines of code. select countryid, countryname, countrycode, longitude, latitude, createdby, createdon, updatedon, updatedby country c exists (select top 1 1 cause cs cs.countryname c.countryname ) basically there 2 tables country countryid , countryname fields , cause 3 fields: causeid , causename , countryname . i trying fetch countries assigned cause. above code not working. select * country c inner join cause cs on cs.countryname = c.countryname this countries have causes. hope understood wanted. this works if cs.countryname identical c.countryname. mind fact exists takes longer join , consider indexing countryname column

r - nth occurrence in a dataframe -

this question has answer here: create counter multiple variables [duplicate] 6 answers i have data.frame 2 columns (firstname , state). my.df = data.frame(firstname = c('john', 'paul', 'john', 'sarah', 'haley', 'paul', 'john'), state = c('vic', 'nsw', 'vic', 'qld', 'tas', 'nsw', 'vic')) firstname state john vic paul nsw john vic sarah qld haley tas paul nsw john vic i include additional column lists nth occurance each value in firstname column. example, 'john' appears in rows 1, 3 , 6 - new column therefore list '1' in row 1, '2' in row 3 (as second time 'john' listed) , '3' in row 6 (as third time 'john' listed). my desired outcome appear follows:

c# - Circular Dependency in an inherited code base -

i'm still learning how structure larger code bases (a year ago had dealt in solutions of 3/4 small projects whilst learning), , i've been trying organise inherited code base rid of circular dependency issue. basically have mvc portal project backed sql database code first using entity framework. have repository project handles communication azure tables. data in these tables overlaps azure table not contain of information portal db. the problem arises when create entities, solution demands created in portal database (so users can see information) , in these azure tables rest of solution uses other purposes. so portal persists data both, meaning need use repository project within mvc project, need repository project able access mvc project peripheral information not persisted azure tables. this bad design, structurally there way around doesn't require major refactoring or changes azure table structure include every little detail of portal db? every "simple

integer - How to convert double to int in Android? -

this question has answer here: converting double integer in java 4 answers i wants convert double int in ui rendering double backend want convert integer. double d = 45.56; output = 4556; please can tell me how value in format. try way, courtesy double d = 45.56; int = (int) d; for better info can visit converting double integer in java

How to install jenkins in bitnami lamp stack using ubuntu 14.04 server? -

i have ubuntu 14.04 server , installed bitnami lamp stack. want install jenkins in server. kindly suggested me procedure that. bitnami developer here, we don't provide modules install jenkins in top of lampstack can install jenkins using installers of stack. can download them using link: https://bitnami.com/stack/jenkins/installer this installer install dependencies run jenkins. example, install apache , if have apache running in same port ask use port. i hope helps. jota

javascript - want to create nested JSON for following array using Node.js -

i want create nested json using following array , separated according: array used create json: [ 'tc0159 - 24 ghanta', (channel name starts tc) '12pm-1659pm (timeslot) 519.00', (rate) '5pm-2259pm 714.00', '6am-1159am 323.00', 'tc0514 - 4 real news', '12pm-1659pm 128.00', '5pm-2259pm 128.00', '6am-1159am 128.00', 'tc0227 - 9 x m', '10pm-10:30pm 1105.00', '12pm-7pm

c# - How to convert datatable record into child custom Class -

i have 2 classes namely: public class parent { public int id { get; set; } public int { get; set; } public int b { get; set; } } public class child : parent { public int c { get; set; } public int d { get; set; } } and have 2 datatables following records datatable (parent table) id b 1 2 4 2 3 6 3 8 7 4 5 9 datatable ii (child table) parentid c d 2 4 10 4 9 7 if want convert parent datatable parent objects user following code: ilist<parent> items = dt.asenumerable().select(row => new parent { id = row.field<int>("id"), = row.field<int>("a"), b = row.field<int>("b"), }).tolist(); obviously parent objects id of 2 , 4 has created child objects have no idea how that. please me on this. in advance. you wrote: obviously parent objects id of

bash - Variable variable assignment error -"command not found" -

when run script following errors. doing wrong here please? appreciated- bash newbie error: line 12: 0=1: command not found line 13: 0=1: command not found my script: count_raw=0 avg_raw=0 $count_raw=1 $avg_raw=1 echo "count_raw=$count_raw" echo "avg_raw=$avg_raw" = assignment operator when found free , $ holds value (not in usa in bash too) of variable. so when say: $var=1 , you're trying type random string ( 0=1 in case) in bash , bash doesn't that. @ one-liner below shows 1 example you'd type in $var=1 , bash able process it: var=1; if [[ $var=1 ]]; printf "congrats! have learned difference between variable assignment , variable comparison in ${var}st attempt.\n"; fi;

php - PHPLint class do not has a parent -

i'm using phplint lint laravel code, things fine, having issue __construct() linting. i using common parent::__construct(); line, phplint telling me classes 'do not has parent'. come across this, , solved it? using sublimelinter in sublime text.

Rest API and UUID -

one of reasons, , main one, use uuid avoid having "centralized" point responsible creating , assigning ids resources. that means that, rest apis, clients (and should) able generate, , give uuid resource when post specific resource first time. minimize problems related posting resource first time not getting id response (connectivity problems example). can result in new post of clients, generating duplicated resources. my question are: having uuid generated clients , being exposed in rest api best practice? are there other alternatives that? rest not care if uuid generated server or client. needs unique resource-identifier in form of uri. form uri has, not important clients , servers - unique , may obtained clients (hateoas). need of course resource on server side able create sub-resource , understands want provide uuid instead of generating own one. instead of uuid f.e. use url-encoded title of blog-post or question combination of hash-value , question-t

mysql - 1000mb database file is not uploading completely -

we have magento site. we have large database of 1000mb site. when try import database through phpmyadmin, it's not uploading full database. lot of tables missing after uploading. qe getting error : script timeout passed, if want finish import, please resubmit same file , import resume we have godaddy cpanel , phpmyadmin. is there way upload large database completely? i planning change php.ini settings mentioned in question: how solve time out in phpmyadmin? but not able find php.ini file. have need edit default magento phi.ini.sample? try in godaddy ssh, log on server. at command line, type su -. gives root access. at command line, type mysql -uroot -p enter mysql root password. select yourdatabase name insert data writing command, use yourdatabasename then load source sql file source d:\profile20\database.sql press enter insert data. this video link may you.

android - (INSTALL_FAILED_MISSING_SHARED_LIBRARY) in AndroidStudio with Moto EMDK -

i'm using androidstudio make tests motorola solution (now zebra technologies) tc55. actual i'm trying use emdk (custom sdk access proprietary features) read barcodes integrated scanner. found many questions , answers don't use functions of google api or else. integrated library "com.symbol.emdk". i followed instruction motorola androidstudio. https://developer.motorolasolutions.com/community/android/android-forums/android-blogs/blog/2015/02/10/developing-emdk-apps-with-android-studio-10x now when try debug or start application on tc55 following error: waiting device. target device: motorola_solutions-tc55-13357521650478 uploading file local path: c:\ausbildung\uebungen\applications\motosdktest\app\build\outputs\apk\app-debug.apk remote path: /data/local/tmp/com.iwr.smith.motosdktest installing com.iwr.smith.motosdktest device shell command: pm install -r "/data/local/tmp/com.iwr.smith.motosdktest" pkg: /data/local/tmp/com.iwr.smith.

c++ - I need help while inserting in a map of integer and set of a structure -

the code : #include <map> #include <utility> typedef struct { int d_number; int o_number; } d_o_pair; std::set<d_o_pair> d_o_set; std::map<int, d_o_set> my_map; } i want insert map. not able to . using : this->my_map[5].insert(make_pair(0, 2)). compiler throws me error telling no function matches call insert following sample code tell inserting map. inserting set, need overload '<' operator define ordering condition in structure constructor , insert in similar fashion using insert function. #include<iostream> #include<map> using namespace std; typedef struct { int d_number; int o_number; }d_o_number; int main() { d_o_number s1; s1.d_number = 100; s1.o_number = 1000; std::map<int, d_o_number> d_o_map; d_o_map.insert(std::pair<int, d_o_number>(0, s1)); // showing contents: std::map<int,d_o_number>::iterator = d_o_map.begin(); std::cout << &

Wrong width of view on startup of iPad app in iOS 7 -

if device (simulator or ipad) in landscape orientation , start app while querying width wrong results. 1 should 1024 in fact i'm getting 768 wrong. on ios 8 work expected. on iphone , ios 7 view first in portrait changes landscape works case. in viewdidload i'm getting the size view.bounds.size.width . if rotate device , query data in didrotatefrominterfaceorientation data correct. app don't need in viewdidload , in method. in viewdidload seems same behavior. what's wrong here? how correct width of view on ios 7 , ios 8? you should try getting width in viewdidlayoutsubviews: or other method comes after in view hierarchy such viewdidappear: hope helps you.

php - Check if email address exist in database and captcha code is correct if not give alert and dont save data in database -

i wrote code form in added 2 validation first 1 through email , second 1 through email. when user enter's email address exist in data base show error. problem faced when user enter's new email address , wrong captcha code show error @ same time save data base also. here's complete code given <?php include('../config/connection.php'); //database insert query if(isset($_post['submit'])) { $finame = $_post['finame']; $email = $_post['email']; $user_message = $_post['message']; $b="select * form email='".$_post['email']."'"; $res = mysql_query($b); $tot = mysql_fetch_assoc($res); if(empty($tot) || empty($_session['6_letters_code'] ) || strcasecmp($_session['6_letters_code'], $_post['6_letters_code']) == 0) { $sel = "insert ".form." set finam='