Posts

Showing posts from May, 2012

postgresql - Append and Overwrite in Amazon Redshift -

as redshift based on postgresql, have option overwrite or append data in table while copying s3 redshift? only thing got use of triggers don't accept argument. all need write script takes argument yes/no (or similar) if data in table. when loading data amazon s3 amazon redshift using copy command, data appended target table. redshift does not have "overwrite" option . if wish replace existing data data being loaded, could: load data temporary table delete rows in main table match incoming data, eg: delete main-table id in (select id temp-table) copy rows temporary table main table, eg: select * temp-table main-table see: updating , inserting new data

model - Laravel Getting Child table values with multiple Parent values -

i need find solution in laravel 5. let me explain problem have 4 tables lets suppose these users, table1, table2, table3. users , table1 have many many relationship. table1 , table2 have many many relationship. , table2 , table3 have many many relationship. now on table3 controller want values respect user. example $table1 = user::find(auth::user()->id)->table1()->get()->lists('id'); $table2 = table1::wherein('id',$table1)->table2()->get()->list('id'); $table3 = table2::wherein('id',$table2)->table3()->get(); on table2 data getting error of badmethodexception. have googled , read documentation unable anywhere. can me how can data please? i have pivot table of table1_user, table1_table2 , table2_table3. in user model have function public function table1(){ $this->blongstomany('app\table1'); } in table1 model have function public function table2(){ $this->belongstomany('ap

c# - OneDrive SDK Canceling Operation -

i'm using onedrive sdk , reading doc, copy operation can canceled. onedrive sdk copy is there work around enable cancelling other operation download , upload , can find way pass cancellationtoken those. public async task download(string itempath) { var driveclient = await onedriveclientextensions.getauthenticatedclientusingonlineidauthenticator(new[] {"wl.signin", "onedrive.readwrite"}); var item = await driveclient.drive.root.itemwithpath(itempath).content.request().getasync(); } cancellation operation not supported in onedrive sdk download , upload. seems sdk team working on it. can follow open issue: cancellation support? in github more information. to support cancellation operation in uwp, can try implement own download , upload method windows.web.http.httpclient class . modern http client api windows store apps , supports cancellation , progress. more information how use class, can refer official ht

Verilog error while declaring a array -

reg [11:0] rom_sin_type [0:4095]= '{12'h000, 12'h003, 12'h006, 12'h009, 12'h00d, 12'h010, 12'h013, 12'h016, .....}; in verilog,when synthesizing above line of code contains 4096 values, each of 12 bit, showing error below given. expecting ';', found '=' expecting 'endmodule', found '{' please can me , how overcome problem? verilog not support '{} syntax. systemverilog ( ieee std 1800-2012 ) feature; refer § 5.10 structure literals , § 5.11 array literals , § 7.2.2 assigning structures , § , 10.9 assignment patterns . you can either enable systemverilog (all modern verilog simulators systemverilog simulators) or assign the verilog way: reg [11:0] rom_sin_type [0:4095]; initial begin rom_sin_type[0] = 12'h000; rom_sin_type[1] = 12'h003; rom_sin_type[2] = 12'h006; rom_sin_type[3] = 12'h009; ..... end

Storing schema-less complex json object in Cassandra -

i have schema-less json object wish store in cassandra db using spring-cassandra. learned cassandra supports map type cassandra doesn't accept map<string, object> data model. i need query on fields of json storing blob out of question. there anyway can this? ps: i've looked @ storing json object in cassandra , answer didn't seem applicable use case json complex. did @ udt (user-defined-type) ? you can define udt this: create type my_json( property1 text, property2 int, property3 map<text, text>, property4 map<int, another_json_type>, ... ) and in java use map<string, usertype> note: usertype comes java driver: https://github.com/datastax/java-driver/blob/2.1/driver-core/src/main/java/com/datastax/driver/core/usertype.java you cannot create user type n java, can metadata of table, see this: https://github.com/datastax/java-driver/blob/3.0/driver-core/src/test/java/com/datastax/driver/core/usertypestest.java#

Geographical proximity aggregation in ElasticSearch instead of geohash? -

i'm using geohash aggregation, i'd have pins aggregated density/priximity rather predefined sections - possible es? yes, possible elasticsearch using decay functions. can read more them here . sample elasticsearch docs "decay_function": { "field_name": { "origin": "11, 12", "scale": "2km", "offset": "0km", "decay": 0.33 } }

c# - Create equipment in Autocad Plant 3d -

i want create equipment predefined shape in autocad plant 3d. retrieve shape , related parameters attached code. using (equipmenthelper eqhelper = new equipmenthelper()) { promptentityresult res = ed.getentity("\nselect equipment entity: "); objectid eqid = res.objectid;; equipmenttype eq = eqhelper.retrieveequipmentfrominstance(eqid); foreach (categoryinfo equipmentcomponent in eq.categories) { ed.writemessage("\n" + equipmentcomponent.displayname); foreach (parameterinfo item in equipmentcomponent.parameters) { ed.writemessage("\n\t" + item.name + ";" + item.value); } } } you'll need custom python script this, check tutorial: custom pyt

sqlalchemy - Query a PostgreSQL view created by SQLAcodegen -

i have useful postgresql view, generated join query: \d very_useful_view; view "public.very_useful_view" column | type | modifiers -------------+-------------+----------- tree_id | dom_treeid | title | text | grass_id | dom_grass | name | text | street_uuid | uuid | the view modeled sqlacodegen following object: t_very_useful_view = table( 'very_useful_view', metadata, column('tree_id', string), column('title', text), column('grass_id', text), column('name', text), column('street_uuid', uuid) ) normal query works expected: print session.query(t_very_useful_view).all() however, filtering - print session.query(t_very_useful_view).\ filter(t_very_useful_view.tree_id == some_tree_id).\ all() raises: attributeerror: 'table' object has no attribute 'tree_id' any idea missing view mapping? the

android - Is it possible to add a TextView to an Adapter Class and store the result in an Activity Class -

Image
i using custom adapter class , want add textview , display in simple activity user_cart.java activity public class user_cart extends fragmentactivity { cartadapter adapter; listview listview; arraylist<hashmap<string, string>> arraylist; public static string dish_name; public static string dish_cost; public static string dish_quantity; button order_btn; textview result; double quantitystrtemp, coststrtemp, totalstr, subtotalstr; private coordinatorlayout coordinatorlayout; databasehandler db = new databasehandler(this); @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.user_cart); result = (textview) findviewbyid(r.id.subtotalet); order_btn = (button) findviewbyid(r.id.orderbt); arraylist = new arraylist<hashmap<string, string>>(); list<order> orders = db.getallorders();

cordova - Universal Windows Development JavaScript support for WebRTC? -

i wanted know if possible implement webrtc , sip.js libraries on universal windows (10) platform using either uwp or cordova. would able use .js libraries or apis? i'm using visual studio 2015. thanks a windows 10 javascript app going use edge browser under hood whether or not using cordova. edge supports ortc (dubbed webrtc2), not webrtc. whichever js libraries work in edge, work in win 10 app. feel free ping me additional questions.

python - How to empty out elements of two arrays after merging two arrays together -

#function def merge_array(a, b): c = [] in a: c.append(i) z in b: if z not in c: c.append(z) c.sort() return c #main = [1,5,2,8,9] b = [8,4,2,8,10,3,14] print("array 1: {}".format(a)) print("array 2: {}".format(b)) print("merged list: {}".format(merge_array(a, b))) print("array 1 empty: {}".format(a)) print("array 2 empty: {}".format(b)) tried putting a.pop() , b.pop() in loops not erase elements , changes 'c' not quite sure if looking if want add lists , take care of duplicates try: list(set(a+b))

c# - comments are getting deleted while updating the web config file programmatically -

comments , keys getting deleted while updating web.config problematically string path = configurationmanager.appsettings["path"]; var map = new execonfigurationfilemap { execonfigfilename = path }; var configfile = configurationmanager.openmappedexeconfiguration(map, configurationuserlevel.none); configfile.appsettings.settings["strkeyname"].value = convert.tostring(intvalue); configfile.save(); may know why happening that, want retain comments .please let me know how can achieve it.

javascript - Overflow scrollbar in popover window not working (Bootstrap) -

i have couple of popovers on site contain number of href tags. of popovers there's no problem in terms of height. however, 2 of them require overflow/scrollbar solution. this have tried far not appear work: html: <div class="col-sm-2"> <a href="#" class="thumbnail" data-toggle="popover" data-trigger="focus" title="yeast & mould" data-content='<ul><li><a href="first link"</a></li> <li><a href="second link"</a></li> <li><a href="multiple links"</a></li> </ul> </a> </div> javascript: <script> $(document).ready(function(){ $('[data-toggle="popover"]').popover({html: true;}); }); </script> css: .popover-content { overflow-y: auto; } any ideas how can resolve problem appreciated. as reddy suggeste

javascript - How to dynamically pass params into a click event method in angular 2 -

my service returns data , use view. i'm trying pass specific id ondivclick method on click event. i want it's not working : <div *ngfor="let d of data" class="widget-body no-padding"> <a class="list-group-item" href="#" (click)="ondivclick({{d.data_id}})"> ... </a> </div> any ideas ? just remove {{}} <a class="list-group-item" href="#" (click)="ondivclick(d.data_id)"> if have () or [] must not use {{}} well

ms word - How to check if my office 365 app compatible with office 2016 for mac or not -

Image
how check(make it) if office 365 app(add-in) compatible office 2016 mac or not trying follow instructions no luck: try out in word 2016 mac can run add-in created. follow these steps see in action: create folder called “wef” in users/library/containers/com.microsoft.word/data/documents/ put manifest, boilerplatemanifest.xml, in wef folder (users/library/containers/com.microsoft.word/data/documents/wef) open word 2016 on mac , click on insert tab > add-ins drop down. should see add-in listed in drop down. select , load add-in. *this website: http://dev.office.com/docs/add-ins/word/word-add-ins yes have issues, don't think should prevent being working on word in mac, running fine in word 2016 windows *could reason, didn't found path in instructions in users folder didn't found library folder !! created it, , rest of path, advice

mongodb - projection document querying fields containing certain letters -

i trying menuitems.find(.. return documents field "group" has letter contained in "menugroup" example: if menugroup "a" return documents group equals a. if menugroup "ab" return documents group field equals "a" documents group field equals "b". reading mongo docs , can't figure out. please help? thanks var items = [ {menuitem: "task1", group: "a"}, {menuitem: "task2", group: "a"}, {menuitem: "task3", group: "b"}, {menuitem: "task4", group: "a"}, {menuitem: "task5", group: "a"}, {menuitem: "task6", group: "a"}, {menuitem: "task7", group: "b"}, {menuitem: "task8", group: "b"}, {menuitem: "task9", group: "b"}, {menuitem: "login", group: "a"}, {menuitem: "logout",

Can't compile GWT app using 2.8.0-SNAPSHOT and Java 8 with gwt-maven-plugin -

i struggling app compile using gwt 2.8.0-snapshot , mojo's gwt-maven-plugin 2.8.0-snapshot i receive same compiler errors each time: [info] --- gwt-maven-plugin:2.8.0-snapshot:compile (default) @ usavappv7 --- [error] jul 20, 2016 9:34:23 java.util.prefs.windowspreferences <init> [error] warning: not open/create prefs root node software\javasoft\prefs @ root 0x80000002. windows regcreatekeyex(...) returned error code 5. [info] compiling module com.utilitiessavings.usavappv7.project [info] [error] internal compiler exception occurred [info] com.google.gwt.dev.jjs.internalcompilerexception: unexpected error during visit. [info] @ com.google.gwt.dev.jjs.ast.jvisitor.translateexception(jvisitor.java:111) [info] @ com.google.gwt.dev.jjs.ast.jmodvisitor.accept(jmodvisitor.java:276) [info] @ com.google.gwt.dev.jjs.ast.jmodvisitor.accept(jmodvisitor.java:265) [info] @ com.google.gwt.dev.jjs.ast.jvisitor.accept(jvisitor.java:118) [info] @ com.google.gwt.dev.jjs.ast.jde

netbeans - Error switching screen Java Fx FXML -

hello. i'm kinda stuck. got error, i'm not able close previous window set new one. here controller : public class controller implements initializable { //------------- init order -------------// @fxml private label text10; @fxml private label text20; @fxml private label text30; @fxml private label text40; @fxml private label text50; @fxml private textfield entry10; @fxml private textfield entry20; @fxml private textfield entry30; @fxml private button btnconnect10; //------------- init reception -------------// @fxml private label text11; @fxml private label text21; @fxml private label text31; @fxml private label text41; @fxml private label text51; @fxml private textfield entry11; @fxml private textfield entry21; @fxml private textfield entry31; @fxml private button btnconnect11; //------------- init connexion -------------// @fxml private imageview img; @fxml private label user; @fxml private label password; @fxml private textfield usr; @fxml private p

javascript - Which eslint rules in my config are slow? -

i have config around 100 rules, , running eslint on project these rules takes around 10 seconds. i'd identify slowest rules , eliminate of them. how do this? there profiler tool eslint? eslint shows spent times of rules if environment variable timing set. example: $ timing=1 eslint lib rule | time (ms) | relative :----------------------------|----------:|--------: valid-jsdoc | 203.798 | 6.7% camelcase | 142.146 | 4.6% no-unmodified-loop-condition | 136.811 | 4.5% indent | 127.138 | 4.2% no-undefined | 124.525 | 4.1% keyword-spacing | 85.397 | 2.8% space-in-parens | 76.179 | 2.5% no-this-before-super | 72.317 | 2.4% no-implied-eval | 69.945 | 2.3% space-infix-ops | 57.128 | 1.9% see official docs on per-rule performance .

c# - 500 internal server error Azure Web App -

i have created web application, sql server , sql database web app in microsoft azure platform.the sql server not running on vm using sql database service. the web app working until inserted data @ database. pages linked database not working @ all. tried find error @ log files , it's error 500.0 modulename= managedpipelinehandler notification= execute_request_handler. do have idea fix that? possible database disfunction cause of server location in azure?

PHP check website online or offline issue -

this works checking whether website online: <?php $host = 'http://jdfhgjfdhjanmczxmcnaushdfjsa.com'; if($socket =@ fsockopen($host, 80, $errno, $errstr, 30)) { echo 'true'; fclose($socket); }else{ echo 'false'; } but when try check multiple sites , not work. return false. why? <?php $hosts = array(); $hosts[] = 'jdfhgjfdhjanmczxmcnaushdfjsa.com'; $hosts[] = 'google.co.il'; $i = 0; foreach($hosts $host){ $i++; if($socket =@ fsockopen($host[$i], 80, $errno, $errstr, 30)) { echo 'true'; fclose($socket); }else{ echo $host.' false'; } } the reason 2nd code doesn't work not accessing hosts correctly change if($socket = @fsockopen($host[$i]...) to if($socket = @fsockopen($host...) you don't need $i index. can rid of altogether. addendum you noted when first posted calling in loop wasn't working calling 1 domain worked. fix above solution original q

Java Swing- adding a label below a single line bottom border in GridBagLayout -

Image
i want label hotel management system copyright 2016 appear below matteborder @ bottom , centered. have tried copyrightl.setverticalalignment(jlabel.bottom); but doesn't seem work. here code: public class admin_hs extends jframe { jbutton bking_btn= new jbutton("bookings"); jbutton fd_btn= new jbutton("financial data"); jbutton ctm_btn= new jbutton("customers"); jbutton room_btn= new jbutton("rooms"); jbutton adc_btn= new jbutton("additional costs"); jbutton endb_btn= new jbutton("ending bookings"); //images jlabel bking_img= new jlabel(); jlabel fd_img= new jlabel(); jlabel ctm_img= new jlabel(); jlabel room_img= new jlabel(); jlabel adc_img= new jlabel(); jlabel endb_img= new jlabel(); jlabel copyrightl = new jlabel("hotel management system \u00a9 2016"); ///panels jpanel pnl1= new jpanel(); jpanel pnl= new jpanel((new flowlayout(flowlayout.left))); ///constructors public admin_hs(){ this.se

php - How to remove woocommerce unnecessary functions which cause load? -

i have woo-commerce plugin installed. use woo-commerce external/affiliate products selling. there lot more function on plugin such as, add cart functions, registrations, coupons, etc. dont need them actually. need front page, single product page buy now button in , back-end settings it. how turn of unnecessary woocommerce functions causing high load time? there 1 solution of make copy of woocommerce in theme , keep file want use ...and don't touch plugin folder. override .... if theme call function overriding theme not in plugin folder ...

asp.net - Avoid double clicking submit with validator display set to dynamic -

i have asp.net customvalidators display="dynamic" . layout of page requires use them without validationsummary. <asp:customvalidator id="vldfirstthree" controltovalidate="txtfirstthree" runat="server" onservervalidate="validatetextbox" validateemptytext="true" errormessage="please enter first 3 characters of owner name.<br />" cssclass="error" display="dynamic" enabled="true"/> if user leaves field blank , clicks submit, error text displayed. if user fixes problem , clicks submit again, validation error text clears, second click required submit page. i've tried writing server-side code , javascript cause validated textbox blur() before submitting, i'm still running need click twice: once clear message , again submit. is there way clear error text , perform submit 1 click? the answer second 1 here: requiredfieldvalidator have click twice . i

Unable to execute a Less CSS loop properly -

i'm trying create different loops (the class should have different background colours), i'm able compile first one. here's example: http://codepen.io/anon/pen/mywgdo?editors=1100 and code i'm using: @temp0-9: #1976d2; @temp10-20: #00bcd4; @gap1: 10; @gap2: 10; .first (@i) when (@i > 0) { span.temp-@{i} { display:block; background: @temp0-9; } .first(@i - 1); } .first(@gap1); .second (@i) when (@i > 15) { span.temp-@{i} { display:block; background: @temp10-20; } .second(@i - 1); } .second(@gap2); the compiled result following: span.temp-9 { display: block; background: #1976d2; } span.temp-8 { display: block; background: #1976d2; } span.temp-7 { display: block; background: #1976d2; } span.temp-6{ display: block; background: #1976d2; } span.temp-5{ display: block; background: #1976d2; } span.temp-4{ display: block; background: #1976d2; } span.temp-3{ display: block; background: #1976d2; } span.

jquery - Rails bootstrap delete confirmation with modal -

i want bevore action while clicking on link. should display bootstrap modal cancel , delete button. code lookslike this: delete button <button class="btn btn-default" data-href="<%= url_for(:action => :delete, :id => @vid.id) %>" data-toggle="modal" data-target="#modalbox"> <i class="fa fa-trash"></i> <%= t "movies.add.delete" %> </button> modal code in application.html.erb -> modal empty. set buttons on page load jquery. works fine. $(".modal-footer").html("<button type='button' class='btn btn-default' data-dismiss='modal'>cancel</button> <a class='btn btn-danger btn-ok'>delete</a>"); and code modal wait this: $("#modalbox").on('show.bs.modal', function(e) { $(this).find('.btn-ok').attr('href', $(e.relatedtarget).data('href&

javascript - Semantic ui dropdown menu not working in react? -

i've learning semantic-ui , works smoothly react until dropdown menu. here's code: render() { return (<div classname="ui form"> <div classname="field"> <div classname="ui selection dropdown"> <input type="hidden" name="options"/> <i classname="dropdown icon"></i> <div classname="default text">options</div> <div classname="menu"> <div classname="item">option 1</div> <div classname="item">option 2</div> </div> </div>

batch file - GS Papersize form PDF -

i want create batch printing ghostscript on printer can papersizes a0 a4. papersize printing comes pdf-document. means a0-pdf-file should keep it's papersize printing a0 paper. gs resizes document defaults example a4 so don't know how can gs: "read papersize of document , print same" my command looks this: "path gs\gswin32c.exe" -sdevice=mswinpr2 -soutputfile="\spool\\print-server\name of printer" -dbatch -dnopause "\server\folder\123456-01.pdf" as far aware ghostscript not resize output, when using mswinpr2 device, possible does. however, won't resizing gs default, resizing printer default. the mswinpr2 device can't change media size selected in printer, print default printer settings. you can't send pdf files of range of sized media mswinpr2 device , have select different media printer. no doubt device extended so, , can have print dialog pop , select different criteria there

javascript - I Need to show bootstrap modal when i click on calendar cell (dncalendar) -

i need how show modal when click on calendar cell, im using dncalendar . want if u click on cell modal open & shows event date on time.. this design calendar (function(a){a.fn.dncalendar=function(n){var l=a(this);var b={};var d=new date();var i=null;var f=new date();var e=function(q,s){var r=new date(q,s-1,1);var o=new date(q,s,0);var p=r.getday()+o.getdate();return math.ceil(p/7)};var h=function(){var z=d.getmonth();var ag=d.getdate();var t=d.getfullyear();var j=b.monthnames[z];if(b.monthuseshortname==true){j=b.monthnamesshort[z]}var x=a("<div id='dncalendar-header' class='dncalendar-header'></div>");x.append("<h2>"+j+" "+t+"</h2>");var v=false;var r=null;if(typeof b.mindate!=="undefined"){var aj=b.mindate.split("-");r=new date(aj[0],aj[1]-1,aj[2]);if(r.getfullyear()>=t){if(r.getmonth()>=z){v=true}}}var m=false;var a=null;if(typeof b.maxdate!=="undefined"){