Posts

Showing posts from January, 2012

php - WooCommerce coupon "forcing" -

right i'm applying 2 coupons programmatically this: if (is_user_logged_in()) { $user = wp_get_current_user(); foreach (array_intersect(array( 'client', 'administrator', 'editor' ), $user->roles) $role) { $woocommerce->cart->add_discount(sanitize_text_field('logged_in')); break; } } $number_products = $woocommerce->cart->cart_contents_count; if ($number_products >= 3) { $woocommerce->cart->add_discount(sanitize_text_field('more_then_3')); } but when user adds coupon has option "check box if coupon cannot used in conjunction other coupons." doesn't allow me add these coupons anymore. need allow these 2 coupons available added. cannot uncheck option user added coupon because users available add alot of them , cannot allow. ideas how fix pr

Ios Swift : Add Message Tone and Vibration when notification received -

using ios 9 , swift 2 i have written function call notification when needed. how add msg tone , vibration when notification received : func getnotification(message:string) { let curentseting = uiapplication.sharedapplication().currentusernotificationsettings() if(curentseting!.types == .none) { let newseting = uiusernotificationsettings(fortypes: [.alert, .badge, .sound], categories: nil) uiapplication.sharedapplication().registerusernotificationsettings(newseting) } let nfnvar = uilocalnotification() nfnvar.firedate = nsdate(timeintervalsincenow: 0) nfnvar.alertbody = message nfnvar.soundname = uilocalnotificationdefaultsoundname nfnvar.userinfo = ["namkey":"namvey"] uiapplication.sharedapplication().schedulelocalnotification(nfnvar) }

linux - How to convert SIGFPE into a C++-exception -

under win32 it's easy convert seh-exception c++-exception _set_se_translator. there similar way convert signals c++-exceptions on linux? need mapping of sigfpe c++-exception. with g++, can use -fnon-call-exceptions option , throw exception fpe signal handler. note not every signal can mapped that, signals arise trapping instructions. fortunately sigfpe such signal.

java - How to find a specific occurrence of a string inside of a string -

the problem this, i'm trying find , 1 occurrence of string, when way can 1 using keyword occurs multiple times. ex. 4 potato, 4 (string want) , 4 house, 4 car how string want, when can't type in keywords string might contain. imagine trying take 1 paragraph out of essay. i've tried stringy.replaceall(str1, str2); variable, no avail. happens replace of string (go figure name replace all) package com.donovan.cunningham; import java.util.arraylist; import java.util.random; public class essaycreator { //creating varz private static string[] lf = {"happy", "sad", "unhappy", "atractive", "fast", "lazy"}; private static string[] op = {"estatic", "melhencohly", "depressed", "alluring", "swift", "lackadaisical"}; private static string pf = " "; private static string temp[]; private static string

Javascript / JQuery Array of objects intersection by property -

given 2 arrays: var users = [{ name: 'alice', typeid: 1 }, { name: 'bob', typeid: 2 }, { name: 'carol', typeid: 3 }]; var authorized = [{ typeid: 1 }, { typeid: 2 }]; i know simplest way users having typeid present in authorized array. in case result should be: [{ name: 'alice', typeid: 1 }, { name: 'bob', typeid: 2 }] var result = users.filter(function(user) { return authorized.some(function(authorizedobj) { return authorizedobj.typeid === user.typeid; }); }) should noted if authorized array contained id's , not objects (something [1, 2] ), solution simpler: var result = users.filter(function(user) { return authorized.indexof(user.typeid) !== -1; })

javascript - Immutable.js ― custom getter method -

i've got complex object lot of nested properties, , need access specific value. rather replicate code doing every time, use function. there way attach method immutable.js object, return specific value object? or have to use separate function (i.e. func(immobj) rather immobj.get('func')() )? what record ? class abrecord extends record({a:1,b:2}) { getab() { return this.a + this.b; } } var myrecord = new abrecord({b: 3}) myrecord.getab() // 4

javascript - Vuejs synchronously request before render data -

i have single page application requires authentication. when user authenticated visit pages or hit reload button in browser request api provide auth data. have error this: [vue warn]: error when evaluating expression "auth.name": typeerror: cannot read property 'name' of null (found in component: <navbar>) this error caused because vue render auth data while request api have not finished yet. is possible make vue wait request api until finish first, before vue render auth data ? just more going on here. here code: // main.js import vue 'vue' import app './app.vue' // root vue import store './vuex/store' // vuex import router './router' // router map sync(store, router) router.start(app, '#app') // end main.js // app.vue <template> <main> <div class="wrapper"> <router-view></router-view> </div> </main> </template> <script>

sorting - Linux sort utility, possible to sort on minimum value of multiple columns? -

a text file has multiple columns of 1 "start" , other "end", both holding positive integer values. however, since objects described (think of them vectors placed on number line) have direction these can end in either orientation this: 400 20 (start @ 400, end @ 20) 10 100 (start @ 10, end @ 100 ) 300 15 (start @ 300, end @ 15) often 1 order these ranges, opposed start or end value. range limits row are:(min(start,end), max(start,end)). sorting lower limit give order: 10 100 (start @ 10, end @ 100 ) 300 15 (start @ 300, end @ 15) 400 20 (start @ 400, end @ 20) this type of sort can accomplished using perl or other similar scripting language, first generating lower range limit, , sorting on it. however, far can tell there no way directly using usual unix/linux sort utility. specifying this: sort -k 1,1n -k 2,2n sorts on first, if there tie, sorts on second. isn't desired sort though. is there way type of "minimum of m

rbenv - Unable to start Ruby Thin Command -

i trying run dashboard written in ruby using dashing framework. however, when go run: dashing start i this: bundler: failed load command: thin (/users/haddad/.rbenv/versions/2.2.3/bin/thin) i should note, did kill thin process manually kill <pid of thin> how fix or restart process? did have dashing framework in gemfile , ran bundle install ?

html - CSS circle not rendering at all from S3 -

i have created circle in css. sits inline text. here code: #circle { float: left; width: 250px; height: 250px; border-radius: 125px; border: 3px solid; padding: 2px; margin: 10px; object-fit: cover; } and corresponding html looks this... <div id="circle"></div> this works , turns out want when i'm opening html file in browser, put html , css s3 circle disappears. ( http://imgur.com/a/azces ) know s3 sees code because when add image background circle shows missing image icon. i tried both javascript , svg circle. both of these not them sit inline text , floating them had no effect. i'm not getting errors in console either. the problem can when in index call css file in link href, tried adding or removing (/) href="/" in beginning or add css directly in head.

softlayer - Soflayer Billing API using Ruby- Extracting per user billing details -

have question softlayer billing api. when try run api code extract data object mask receive error below: /library/ruby/gems/2.0.0/gems/softlayer_api-3.2.1/lib/softlayer/apiparameterfilter.rb:82:in object_mask': object_mask expects strings (argumenterror) /library/ruby/gems/2.0.0/gems/softlayer_api-3.2.1/lib/softlayer/service.rb:156:in object_mask' testauthentication_old.rb:53:in `' require 'softlayer_api' require 'pp' user_id = "your user id" api_key = "your api key" object_mask = {"orderitem" => {"order" => {"userrecord" => {"username" => ""}}}, "invoiceitem" => {"totalrecurringamount" => ""}} billing = softlayer::service.new("softlayer_account",:username => user_id,:api_key => api_key) user_bill=billing.object_mask(object_mask).getnextinvoicetoplevelbillingitems pp user_bill item in user_bill if item.k

Eclipse tab key inserts tags -

i use eclipse luna php. however, after variable or word, tab key not insert tab, converts word tag. example, tab after $matches display <1matches></1matches> . the problem held in window -> preferences -> emmet -> expand abbreviations tab key (this option should not ticked)

javascript - How to make a DIV pop out from nowhere Jquery? -

so have game want show 2 numbers. want these numbers come out nowhere, perhaps button of screen , travel , disappear. i looking through jquery website, couldn't find similar. heres example wrote: $(document).ready(function() { $("button").click(function(){ $('.count').html(parseint($('.count').html())+1); //allow time animation finish before next click $('button').hide(); window.settimeout(function(){$('button').show();},3000); $("div").css("bottom","-20px"); $("div").animate({bottom: '1200px'}, 2000); }) }); https://jsfiddle.net/xop36gcs/4/

Using reflection in C++ for LINQ -

i working on small database project using c++ , linq c++ . i know reflection doesn't come c++ default, confused how can write "query" , pass in application @ runtime. use string. sql query can string pass sqlcommand.

How Can I replace this type "int" by"String" in c programming? -

this question has answer here: how check if value matches string 3 answers i'm using dev c++ . silly program ask correct key show text. program working type "int" (just numbers): #include <stdio.h> #include<conio.h> main() { int key; printf("this program show mensage if correct key \n"); printf("write key:\n"); scanf("%i",&key); if(key==1234) { printf("welcome stackoverflow \n"); } else { printf("you keep going slept \n"); } getch(); return 0; } but how can replace strings example: sesame, house , on. i've tried matrix: char key[]; however error. sincerily nin. update: i new program : #

iOS base64 encoding -> php decoding -

good afternoon stack overflow i have issue posting image ios device php-webserver using base64 encoding. i have converted uiimage string in xcode using; nsstring *imagestring = [uiimagepngrepresentation(attachmentimage) base64encodedstringwithoptions:0]; fired on server using http post, fine have echo-ed same string , have seen working. and server-side decoding using; $decoded = base64_decode($base64string); file_put_contents($targetfile, $decoded); the smug android guy sitting next me has put version of app , works fine using php script containing above code. although knowledge of base64 limited, have checked 2 non alpha numeric characters used encoding standard ('+','/') , mentioned earlier have checked communication between app/server - fine. right thinking there maybe problem converting uiimage png have searched points me @ commands im using. i have been on day , quick running out of hair pull out - appreciated. thanks in advance

Python output on a separate lines -

i have simple question python. wrote working script when execute it, gives me answer in 1 line, string. looking answer on 2 separate lines. here code: python code def test(): fh=open('xxxxxxx.txt', 'r') fo=open('output.txt', 'a') line in fh: line=line.strip() if(line.startswith('total sequences')): fo.write(line) fh.close() fh2=open('xxxxxxx.txt', 'r') fo2=open('output.txt', 'a') line in fh2: line=line.strip() if(line.startswith('sequence length')): fo2.write(line) fh2.close() print(test()) you removing newline characters "\n" each line in file statement:- line=line.strip() just remove , should work correctly.

tableview - How to access table data from outside the controller in javafx -

i'm trying create material inventory program uses tableview. have controller show statistics based on tableview i'm not sure how access live data view. my mainapp loads last saved table , materialoverviewcontroller has tableview. i have rootlayoutcontroller main layout controller has simple file menu onfloorstatscontroller loaded from. i can create new mainapp when onfloorstatscontroller loaded loads sample data entered default. how access live data mainapp? here mainapp code: public class mainapp extends application { private stage primarystage; private borderpane rootlayout; private observablelist<material> materialdata = fxcollections.observablearraylist(); @override public void start(stage primarystage) { this.primarystage = primarystage; this.primarystage.settitle("label inventory"); this.primarystage.geticons().add(new image("file:resources/images/1462487405_mask.png")); ini

testing - Bulk edit test steps in excel and then import to MTM? -

is possible bulk edit test steps in excel , import mtm? ive found can create query , open in excel display data need, can add on column "steps" , can enter in step single line cannot multiple steps? had luck this? ive tried doing multi line in cell of excel strips out formatting on publishing , keeps on 1 step line in mtm. ive tried put steps on separate lines still imports 1 step instead of two thanks in advance so figured out myself. excel integration bulk steps isnt integrated yet can through web interface of vsts. you change view of query grid mode , enables see tests in depth , add rows copy & pasting. not definitive solution helps cause!

c++ - Anywhere show all the free functions in doxygen documentation? -

i using doxygen document code. found can find classes since there tab calles "classes". cannot free functions listed together. have go tab "files" them. can put free functions in doxygen documentation? there method group items in pages , method involve comment writing side. there not yet available automated way group free functions together. still using grouping option, can place items want given page in documentation. more , examples @ doxygen page: doxygen/manual/grouping

Java Regex pattern.matcher Understanding -

consider following code import java.util.regex.*; public static void main(string[] args) { string str = "suneetha n.=9876543210, pratish patil=9898989898"; pattern pattern = pattern.compile("(\\w+)(\\s\\w+)(=)(\\d{10})"); matcher matcher = pattern.matcher(str); string newstr = matcher.replaceall("$4:$2,$1"); system.out.println(newstr); } output of above code is suneetha n.=9876543210, 9898989898: patil,pratish i not able understand use of matcher.replaceall("$4:$3,$1") , how works , produces output. please provide suggestion on it. you have "(\\w+)(\\s\\w+)(=)(\\d{10})" regex , imagine create groups founded string. in example pratish patil=9898989898 and here groups regex: (\\w+) => pratish $1 (\\s\\w+) => patil $2 (=) => = $3 (\\d{10}) => 9898989898 $4 then said want replaceall regex new ordering $number defined group. replacing pra

Missing Visual Studio Android emulators from Cordova project targets -

Image
the last time updated visual studio, accidentally unchecked 'android emulators' modules list, got uninstalled. since need them, went , modified installation windows 'add or remove programs', checked , installed 'android emulators' visual studio module, , seemed fine. but then, when tried build android version of apache cordova app, noticed android emulators did not added target list. cordova project set start project. i tried reinstalling whole module , reinstalling device profiles, they're still missing. is there way configure devices/emulators show in list? thank you. so seems missing visual studio emulators android, have pre configured show 5" , 7" option. fresh install missed component (because not automatically checked). modify "microsoft visual studio" add or remove programs menu, , check vs emulators android add them version of vs. see checklist image below component is. if want create custom android em

maps - Promoted Property in Orchestration -

i have reading can promote property in orchestration. below steps - create new "studentid" promoted property. change value "messagecontextpropertybase". update value of "studentid" in orchestration. create new correlation set of "studentid". initializing correlation set of send shape. create send port in biztalk administrator console. set filter "poc.promotedproinox.schema.propertyschema.studentid == "7" " i getting no error. want if "studentid" 7 should subscribe. issue - think it's not checking value of "studentid" message file drop in out folder. am missing something? there several things missing if message on receive port has message has same promoted property correct studentid of 7, both orchestration , send port subscribe it. if set studentid else in orchestration message sending through send port didn't go through orchestration came directly receive port.

Output file is getting generated on slave machine in apache spark -

i facing issue while running spark java program reads file, manipulation , generates output file @ given path. every thing works fine when master , slaves on same machine .ie: in standalone-cluster mode. problem started when deployed same program in multi machine multi node cluster set up. means master running @ x.x.x.102 , slave running on x.x.x.104 . both master -slave have shared ssh keys , reachable each other. initially slave not able read input file , came know need call sc.addfile() before sc.textfile() . solved issue. see output being generated on slave machine in _temporary folder under output path. ie: /tmp/emi/_temporary/0/task-xxxx/part-00000 in local cluster mode works fine , generates output file in /tmp/emi/part-00000 . i came know need use sparkfiles.get() . not able understand how , use method. till using dataframe dataobj = ... dataobj.javardd().coalesce(1).saveastextfile("file:/tmp/emi"); can 1 please let me know how call sparkfile

Having a local my.cnf for mysql -

is possible have local my.cnf file mysql in can override global 1 in /etc/mysql . using ubuntu 14.04. installed mysql apt-get . yes, possible. create file called .my.cnf in home folder. can this: [client] host =<mysql server ip> user =user password =pass

c# - Refresh WPF Datagrid not bound to observable collection? -

i using linq sql datagrid , binding data auto generated fields. data updates fine when when submitting changes via linq. problem having cannot seem refresh updated data after run sql statement on database directly. databases data updated correctly , closing down , re-starting application data updated correctly. i have tried, mytable.items.refresh(); and private databasedatacontext sql = new databasedatacontext( properties.settings.default.staffconnectionstring); sql.refresh(system.data.linq.refreshmode.overwritecurrentvalues); the xaml used bind data datagrid column, info_data auto generated field database table. <datagridtemplatecolumn header="info" width="*" sortmemberpath="words"> <datagridtemplatecolumn.celltemplate> <datatemplate> <textblock fontweight="light" text="{binding path

sql server - How to bulk update the date column -

i have table 10000 records. sample id transaction_id contract_id contractor_id servicedetail_id servicemonth unitsdelivered createdate ---------------------------------------------------------------------------------------------------------------------------- 1 1 352 466 590 2016-03-01 203 2016-04-25 17:01:55.000 2 1 352 466 566 2016-03-01 200 2016-04-25 17:02:38.807 3 1 352 466 138 2016-04-13 20 2016-04-13 00:00:00.000 5 1 352 466 138 2016-04-14 21 2016-04-13 00:00:00.000 6 10011 40 460 68 2016-03-17 10 2016-04-25 17:20:13.413 7 10011 40 460 511 2016-03-17 15 2016-04-25 17:20:13.413 8 10011 40 460 1611 2016-03-17 20 2016-04-25 17:20:13.413 9 20011 352 466 2563 2016-02-05 10 2016-04-25 17:20:25.307 11 100 40 460 68 2016-03-17 10 2016-04-25 17:29:23.653 in table have servicemonth different dates. i want update servicemonth column existing months last date. suppose if have 2016-03-17 in table, should

c - how do you store data from a for loop into a variable for other calculations? -

i'm trying store sums variable add percentage between years. right i'm stumped on how this. searched answers , tried few things ,but no luck yet. wondering if point me in right direction figure out.i keep getting memory location , not value. i'm college student please bear me. appreciated. here's code review. #define years 4 #define months 12 int main(void) { float percentage [4]; int = 0, j = 0, n = 0, sum = 0; int time[] = { 2012,2013,2014,2015}; int *value[years]; const char* name[]= {" jan ", "feb ", "mar ", "apr ", "may ", "jun ", "jul ","aug ","sep ","oct ","nov ","dec "}; int range[years][months] = { { 5626, 5629, 5626, 5606, 5622, 5633, 5647, 5656, 5673, 5682, 5728, 5728}, { 5741, 5793, 5814, 5811, 5831, 5854, 5857, 5874, 5900, 5923, 5954, 5939}, { 5999, 6020, 6062, 6103, 6115, 6128, 6

amazon web services - awslogs agent can't keep up -

i'm running awslogs agent on server, , when in cloudwatch logs in aws console, logs 60 minutes behind. our server produces 650mb of data per hour, , appears agent not able keep up. here our abbreviated config file: [application.log] datetime_format = %y-%m-%d %h:%m:%s time_zone = utc file = var/output/logs/application.json.log* log_stream_name = {hostname} initial_position = start_of_file log_group_name = applicationlog [service_log] datetime_format = %y-%m-%dt%h:%m:%s time_zone = utc file = var/output/logs/service.json.log* log_stream_name = {hostname} initial_position = start_of_file log_group_name = servicelog is there common way speed of awslogs agent? the amount of data (> 0.2mb/s) not issue agent. agent has capacity of 3mb/s per log file. however, if you're using same log stream multiple log files, agents write same stream, , end blocking each other. throughput more halves when share stream between log files. also, there a few properties can con

wordpress - get content of url ignoring redirect with php curl -

is possible ignore 301 moved permanently redirect , contents of original webpage. example: have domain1.xxx/post1/ , redirect domain2.xxx/home/ (but i'm sure post1 still prensent in first url) possible content of post1 domain1.xxx? <?php $url = 'domain1.xxx/post1/'; $ch = curl_init(); curl_setopt($ch, curlopt_url,$url); curl_setopt($ch, curlopt_header,1); curl_setopt($ch, curlopt_nobody,0); curl_setopt($ch, curlopt_returntransfer, 1); //important curl_setopt ($ch, curlopt_followlocation, 0);//important $r = curl_exec($ch); curl_close($ch); echo $r; ?>` but return me : "moved permanently the document has moved here." is test not hacking have authorization of owner of site test this. site done wordpress. thnak

json - Mailgun stats don't add up -

i'm trying make sense of mailgun stats returned api, , numbers don't add up. i'm making following call $stats = $mg->get('example.com/stats/total', array( 'event' => array('accepted', 'delivered', 'failed', 'stored'), 'duration' => '1m', "resolution" => "month" )); and result (re-formatted json easier reading) { 'accepted' : { 'incoming' : 200, 'outgoing' : 458, 'total' : 658 }, 'delivered' : { 'smtp' : 399, 'http' : 0, 'total' : 399 }, 'failed' : { 'temporary' : { 'espblock' : 0 }, 'permanent' : { 'suppress-bounce' : 0, 'suppress-unsubscribe' : 0, 'suppress-complaint' : 0, 'bounce'

Excel - Auto fetching data from website to excel -

i trying write code automatically data website, replace last part of url address (text: "22a") text have in cell, example, "g1" code recorded macro: sub usa() ' ' usa n-numbers macro ' ' activesheet.querytables.add(connection:= _ "url;http://www6.landings.com/cgi-bin/nph-search_nnr?pass=193800885&&nnumber=22a" _ , destination:=range("$a$1")) .name = "nph-search_nnr?pass=193800885&&nnumber=22a" .fieldnames = true .rownumbers = false .filladjacentformulas = false .preserveformatting = true .refreshonfileopen = false .backgroundquery = true .refreshstyle = xlinsertdeletecells .savepassword = false .savedata = true .adjustcolumnwidth = true .refreshperiod = 0 .webselectiontype = xlspecifiedtables .webformatting = xlwebformattingnone .webtables = "18" .webpreformattedtexttocolumns = true .webconsecutivedelimitersasone = true .websingleblocktextimport = false .webdisabledaterecognition =

database - Onix files connected to Shopify or Wordpress [help] -

what best system or method bulk upload onix data either wordpress website or shopify platform. use accumen book software manage onix files , i'm looking feed information book selling page, , across whole website. i'm not looking technical, can't implement myself looking answers in direct programmer/developer do. i'm designer trade, , once website designed, i'm hoping hire handle back-end , integration of database via onix. i'm working project pulls onix files wordpress. try wp import plugin, lets define field want pull onix file. have full/paid version of plugin if want import custom fields.

ruby on rails - Soft delete with associations -

i have 3 models: user: class user < activerecord::base has_many :posts, :dependent => :destroy scope :active, -> { where(deleted: false) } end post: class post < activerecord::base belongs_to :user has_many :comments, :dependent => :destroy scope :active, -> { where(deleted: false) } end comment: class comment < activerecord::base belongs_to :post scope :active, -> { where(deleted: false) } end now, doing soft delete user , have column named deleted in 3 tables( user, post, comment ) user destroy method: def destroy @user = user.find(params[:id]) if @user.update_attributes(deleted: true) @user.posts.each |post| post.comments.update_all(deleted: true) end @user.posts.update_all(deleted: true) end end the above implementation takes more time when no. of posts , comments high , creates n+1 query problem.. same above have implemented destroy method post , don't know how efficiently.. i don&#

javascript - datatables export to excel <select option> -

in test page have insert option list , need export excel selected value, excel result include list of "select option". my code: <!doctype html> <html> <head> <title>test export excel "select option" </title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> </head> <body> <script src="https://code.jquery.com/jquery-1.12.3.js"></script> <script src="https://cdn.datatables.net/1.10.12/js/jquery.datatables.min.js"></script> <script src="https://cdn.datatables.net/buttons/1.2.1/js/datatables.buttons.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/2.5.0/jszip.min.js"></script> <script src="https://cdn.rawgit.com/bpampuch/pdfmake/0.1.18/buil

mysql - Counting associated entries with Sequelize -

i have 2 tables, locations , sensors . each entry in sensors has foreign key pointing locations . using sequelize, how entries locations , total count of entries in sensors associated each entry in locations ? raw sql: select `locations`.*, count(`sensors`.`id`) `sensorcount` `locations` join `sensors` on `sensors`.`location`=`locations`.`id`; group `locations`.`id`; models: module.exports = function(sequelize, datatypes) { var location = sequelize.define("location", { id: { type: datatypes.integer.unsigned, primarykey: true }, name: datatypes.string(255) }, { classmethods: { associate: function(models) { location.hasmany(models.sensor, { foreignkey: "location" }); } } }); return location; }; module.exports = function(sequelize, datatypes) { var sensor = sequelize.define("se

html - How To Make The Nav MenuBar Not Go Across The Whole Page -

i built nav menu bar, background color going across whole page, not want. css: body { padding: 0; margin: 0; font-family: arial; font-size: 19px; } #nav { background-color: #222; } #nav_wrapper { width: 960px; margin: 0 auto; text-align: left; } #nav ul { list-style-type: none; padding: 0; margin: 0; position: relative; min-width: 200px; } #nav ul li { display: inline-block; } #nav ul li:hover { background-color: #333; } #nav ul li a, visited { color: #ccc; display: block; padding: 15px; text-decoration: none; } #nav ul li:hover ul { display: block; } #nav ul ul { display: none; position: absolute; background-color: #333; border: 5px solid #222; border-top: 0; margin-left: -5px; } #nav ul ul li { display: block; } #nav ul ul li a:hover { color: #699; } #nav { background-color: #222; } in here can adjust width , height of navbar, or else should post ht

javascript - How to pass file data with ajax and jquery -

This summary is not available. Please click here to view the post.

fail to run maven on jenkins on a closed environment -

Image
i trying run simple build using maven on jenkins (1.651.2) windows. working on closed environment has no internet connection. trying same on internet pc works fine. command line works fine on jenkins error: building on master in workspace c:\source\maven error: failed parse poms java.net.malformedurlexception: no protocol: @ java.net.url.<init>(unknown source) @ java.net.url.<init>(unknown source) @ java.net.url.<init>(unknown source) @ hudson.tools.zipextractioninstaller.performinstallation(zipextractioninstaller.java:79) @ hudson.tools.installertranslator.gettoolhome(installertranslator.java:68) @ hudson.tools.toollocationnodeproperty.gettoolhome(toollocationnodeproperty.java:108) @ hudson.tools.toolinstallation.translatefor(toolinstallation.java:206) @ hudson.model.jdk.fornode(jdk.java:143) @ hudson.model.abstractproject.getenvironment(abstractproject.java:357) @ hudson.model.run

React native Image component not working in android -

i'm new react native , i'm having problem working image. to simplify question, i've created new react native project , added image component in index.android.js below: /** * sample react native app * https://github.com/facebook/react-native * @flow */ import react, { component } 'react'; import { appregistry, stylesheet, text, view, image, } 'react-native'; class testproject extends component { render() { return ( <view style={styles.container}> <text style={styles.welcome}> welcome react native! </text> <image source={{uri: 'http://facebook.github.io/react/img/logo_og.png'}}/> <text style={styles.instructions}> started, edit index.android.js </text> <text style={styles.instructions}> shake or press menu button dev menu </text> </view> ); } } const styles = stylesh

ms office - Disable the automatic conversion to Date -

Image
in 1 workbook (from else) need analyse, use formula construct list of strings: 04-09-01 , 04-09-02 , 04-09-03 , etc, have general format. in part of code, need copy these values somewhere else. however, because these values quite special, automatically considered date (whereas not dates users) , transformed 09/04/2001 , 09/04/2002 , 09/04/2003 , etc. consequence, values changed, , calculation based on these pasted values lead errors. here test code: function test () { excel.run(function (ctx) { var r0 = ctx.workbook.worksheets.getitem("sheet1").getrange("a2:a10"); var r1 = ctx.workbook.worksheets.getitem("sheet1").getrange("f2:f10"); r0.load(["values"]); return ctx.sync() .then(function () { console.log(r0.values.tostring()); r1.values = r0.values; }) .then(ctx.sync) .then(function () { r1.load(["values"]); }) .then(ctx.sync)

javascript - How to process click event of dynamically created hyperlinks? -

i have dynamically generated links <a name="details" id="1" href="javascript:;">details</a> when 1 of them clicked want process event javascript code this $(document).ready(function () { var = document.getelementsbyname('details').item(0); a.on('click', function () { $.ajax({ /// }); }); }); however, though seems find hyperlinks quite perfectly, on click event doesn't enter function. what wrong implementation? on method find on jquery objects. document.getelementsbyname('details').item(0) returns native dom element. either use addeventlistener instead of on or $("some selector") instead of getelementsbyname & item .

sql server - How to split multiple comma-separated value that are in columns to new columns -

i got same / similar problem in ' how split comma-separated value columns ' , solution code needs more flexible. i got multiple (n) columns comma separated values. e.g.: column1 column2 ====================== a1, a2, a3 er, asw, a2, a3 qwe, qw what need this column1_1 column1_2 columm1_3 column2_1 column2_2 column2_3 ================================================================== a1 a2 a3 er asw a2 a3 null qwe qw null so depending on columns "longest" (most comma seperated values) need new columns same name , index (here 1-3). if 1 cell has less maximum values (e.g. in case 2) remaining new columns should not contain values respecectively null. i hope me this! thanks lot! edit: tried using code. works far, not flexible , taking 1 column instead of "n columns" declare @xml xml select @xml = ( select cast( '<i id="' + cast(colu

Do jhipster support repository other than git or sourcetree? -

i want create application without using jhipster don't want use github. possible?. getting below error while creating application . c:\users\user\myapplication>yo jhipster module.js:327 throw err; ^ error: cannot find module 'downgrade-root' @ function.module._resolvefilename (module.js:325:15) @ function.module._load (module.js:276:25) @ module.require (module.js:353:17) @ require (internal/module.js:12:17) @ object.<anonymous> (c:\users\user\appdata\roaming\npm\node_modules\yo\node_modules\root-check\index.js:2:21) @ module._compile (module.js:409:26) @ object.module._extensions..js (module.js:416:10) @ module.load (module.js:343:32) @ function.module._load (module.js:300:12) @ module.require (module.js:353:17) github online project hosting using git, , jhipster application huge spring boot application can host in bitbucket, gitlab, svn, zip file, etc. the error having else... looks 'npm' e

python - number of rows in two files different--> make equal by deleting from end -

open(filename,"r") f: reader = csv.reader(f,delimiter = ",") data = list(reader) rownum = len(data) open(filename2,"r") f: reader2 = csv.reader2(f,delimiter = ",") data2 = list(reader2) rownum2 = len(data) if rownum > rownum2: delete(rownum until rownum = rownum2 @ end) it's pretty simple. data = data[:max(rownum, rownum2)] data2 = data2[:max(rownum, rownum2)]

django - How to clear a database on OpenShift -

Image
i'm using django sqlite3 on openshift , need reset database (clear tables). how do that? you can run flush command clear data tables. python manage.py flush note command irreversibly destroy data in database. to run manage.py command in openshift, make sure have ssh access repository. step 1 method 1: redhat client the easiest way install rhc, you can install rhc following official guide after installation , configuration, run rhc ssh <app name> if gone correct, logs app repo. (or) method 2: without redhat client add public key on console settings copy ssh command remote access section on console. the command looks like, ssh <some random string >@your-domain.rhcloud.com paste command terminal window , press enter step 2 now navigate source directory, run cd app-root/repo/ step 3 now @ repo, can run manage.py task python manage.py makemigrations or python3 manage.py migrate this how run manage.py c

javascript - Is it considered better to write if return else return or if return followed by implicit else return? -

which of following considered better or more standard? if followed implicit else if (something === true) { return } return null if followed explicit else if (something === true) { return } else { return null } the background why asking find explicit else option easier read , better, while have colleagues prefer implicit else because more succinct. just choose guideline , follow it. airbnb javascript guideline quiet popular https://github.com/airbnb/javascript . i prefer if (something === true) { return } return null there no need wrap inside else statement if there no code following it

javascript - Flow type checker errors in node_modules/* -

i've initialized flow project flow init in fresh https://github.com/davezuko/react-redux-starter-kit project. when flow check, finds several errors in node_modules. errors happening in /* flow */ annotated library files. it looks this: node_modules/editions/source/index.js:33 33: const {name, editions} = require(packagepath) ^^^^^^^^^^^^^^^^^^^^ parameter passed require() must literal string. node_modules/fbjs/lib/deferred.js.flow:60 60: promise.prototype.done.apply(this._promise, arguments); ^^^^ property `done`. property not found in 474: declare class promise<+r> { ^ promise. see lib: /private/tmp/flow/flowlib_d34ebcf/core.js:474 node_modules/fbjs/lib/shallowequal.js.flow:29 29: return x !== 0 || 1 / (x: $flowissue) === 1 / (y: $flowissue); ^^^^^^^^^^ identifier `$flowissue`. not resolve name should make flow ignoring files? assume may affect t

c# - Delete SSL Certificate without prompting the user -

i have written lines of code delete certificates certificate store before installing new 1 if certificate exists, below: x509store store = new x509store(storename.root, storelocation.currentuser); store.open(openflags.readwrite | openflags.includearchived); x509certificate2collection certs = store.certificates.find(x509findtype.findbysubjectname, "certname", false); if (certs.count > 0) { foreach (var cert in certs) { store.remove(cert); } } but, each time certificate detected before deleted promts user press yes cert deleted. possible delete certs without asking user? is possible delete certs without asking user? the short answer no. certificate management (add/remove certs) in current user\trusted root cas requires explicit user consent. behavior hardcoded in crypt32.dll library.

amazon web services - Is it possible to download file from instance via aws-api-tools -

i haven't key file .pem download via scp, possible download via amazon api(i have aws_access_key & aws_secret_key)? i'm tried find such endpoint( http://docs.aws.amazon.com/awsec2/latest/commandlinereference/ ) ineffectually. no, not possible. there many guides online describe how replace lost keypair if option you.

Rails engine: NameError: uninitialized constant Active****. Using require 'active_***' acceptable? -

i'm working rails engine uses activerecord/activejob , getting error: nameerror: uninitialized constant activejob to fix this, within engine.rb added require e.g. require 'active_job' module mymod class engine < ::rails::engine ... however has been suggested me bad way solve problem , alternative check constant defined instead within affected method call. e.g. if defined?(activejob). less happy solution. can suggest resources discuss this, suggest why 'require' may bad, or suggest alternate solutions? edit: should state both solutions fix problem; matter of understanding why within rails engine rails classes (e.g. activerecord/activejob) not available unless explicitly required (which suspect engines dependencies not autoloaded) , how 'best' make them available within engine itself.