Posts

Showing posts from September, 2010

html - CSS - How to remove thin white line between :after element and blue border on hover on image -

this structure: <div class="parent"> <a href="#"> <p class="carousel_img"> <span class="img"></span> text </p> </a> , style: .parent{ height: 270px; width: 270px; } .img { background-image: url(http://frontendtest.ru/anit/img/ps_3.jpg); background-size: cover; display: block; height: 250px; overflow: hidden; border-radius: 50%; -webkit-transform: scale(1.3); -ms-transform: scale(1.3); transform: scale(1.3); -webkit-transition: -webkit-transform 0.3s; transition: -webkit-transform 0.3s; transition: transform 0.3s; transition: transform 0.3s, -webkit-transform 0.3s; background-repeat: no-repeat; } .carousel_img { border-radius: 50%; border: 4px solid #f6e9d6; height: 260px; width: 260px; overflow: hidden; -webkit-transform-style: preserve-3d; transform-style: preserve-3d; position: relative;

Parts of Java Animation dissappear -

i made short java animation runs in new thread. animation gets drawed on canvas. refreshes every 100ms. on ticks rectangle doesnt show up.(on linked video can see it) tried solutions on internet because of standard english didnt know how google right way. package com.felix.pack; import java.awt.canvas; import java.awt.dimension; import java.awt.graphics; import javax.swing.jframe; public class draw extends canvas implements runnable { thread x; int xpos = 0; int ypos = 0; jframe window; boolean runs = false; graphics g; public draw() { dowindow(); setpreferredsize(new dimension(500,500)); window.add(this); } @override public void run() { g = getgraphics(); while (runs) { paint(g); try { thread.sleep(100); xpos +=1; ypos +=1; } catch (interruptedexception e) { // todo auto-generated catch block

Can I have multiple filters in an Elasticsearch index's settings? -

i want elasticsearch index stores "names" of features. want able issue phonetic queries , type-ahead style queries separately. think able create 1 index 2 analyzers , 2 filters; each analyzer use 1 of filters. not seem able this. here index settings json i'm trying use: { "settings": { "number_of_shards": 1, "analysis": { "analyzer": { "autocomplete_analyzer": { "type": "custom", "tokenizer": "standard", "filter": ["standard", "lowercase", "ngram"] } }, "analyzer": { "phonetic_analyzer": { "tokenizer": "standard", "filter": "double_metaphone_filter" }

windows - RtlQueryRegistryValues read REG_DWORD -

i'm writing uart16550 driver, , 1 of things have read registry initialization parameters using rtlqueryregistryvalues. (a lot of code skipped...) rtl_query_registry_table table[2]; and table[1].queryroutine = null; table[1].name = null; the parameter stored in registry reg_dword , i'm trying set table with: unsigned long buffer; (because dword not defined in ntddk.h , i'm not sure if break including windef.h) and table[0].entrycontext = &buffer; the status of call rtlqueryregistryvalues status_success status = rtlqueryregistryvalues( rtl_registry_absolute, path, table, null, null); but when try to dbgprint("registry: %lu", buffer) i way big numbers (i expected result 1 or 2). am doing wrong dbgprint, or parameters aren't set correctly query table? and red_dword data type defined? edit: wchar keyname[20] = "parameter"; char def[20] = "parameter"; wchar path[100] = l"\\regist

c# - How working with fields out from DetailsView -

i'm newbie in asp.net c#. i made site on classic asp, need recreate on .net. using detailsview on detail page. i need move fields place on mi page. example: put name on page top, email place on top right side inside div formatted bootstrap. i don't know how separate fields grouped on detailsviews's table. all information on ms site talks detailsview, stuff it's cool want more flexibility placing fields anywhere. detailsview's table makes me feel tied. can add section of code trying change? may easier understand question.

Get the number of distinct property values in List<T> using LINQ in C# -

in list list<myclass> listofmyclasses , how can 1 how many distinct groupid property values there using linq? public class myclass { public int groupid; } for example let's have list: listofmyclasses: {myclass1 (groupid = 1), myclass2 (groupid = 3), myclass3 (groupid = 1)} here should result 2 (two distinct numbers groupid). here 1 way using distinct : listofmyclasses.select(t => t.groupid).distinct().count() or can use groupby : listofmyclasses.groupby(t => t.groupid).count()

python - Value lookup in Redis 2.4 -

i need list keys contain value. use scan command, problem client using redis server version 2.4.14 , updating not option (legacy app lot of hacks might break). what guys do? i'm using "redis" python client. thanks!

c++ - Different content of &a -

im looking better understanding of following 3 examples. this questions following code examples. ex. 1. example makes sense, outputs adress of int stored. ex. 2. makes little less sense for. think because char points char? ex. 3. confuses me. in output first char output on stored in char. appending chars , why appear after saving &a char pointer? lastly how output adress of memory location of char variable saved? ex. 1 main(void) { int = 1; cout << &a; } outputs memory adress ex. 0x7fff4241b7b4 ex 2. main(void) { char = 'a'; cout << &a; } outputs char a. ex. a ex. 3. main(void) { char = 'a'; char *b = &a; cout << &a; } outputs a��:�� the first pointer matches operator<<(const void*) outputs pointer value; second , third match operator<<(const char*) output null-terminated string. char a value on stack, totally undefined whether bytes after first byte null or

java - Enumerate Custom Slot Values from Speechlet -

is there way inspect or enumerate custom slot values set-up in interaction model ? instance, have intent schema following intent: { "intent": "mysupercoolintent", "slots": [ { "name": "shapesnsuch", "type": "list_of_shapes" } ] } furthermore, you've defined list_of_shapes custom slot have following values: square triangle circle icosadecaheckaspeckahedron round husky question: there method can call speechlet or requeststreamhandler give me enumeration of custom slot values?? i have looked through alexa skills kit's sdk javadocs located here and i'm not finding anything. i know can slot's value sent in intent: string slotvalue = incomingintentrequest.getintent().getslot("list_of_shapes").getvalue(); i can enumerate all incoming slots (and values): map<string, slot> slotmap = incomingintentrequest.getintent().getslots(); for(m

java - Dagger 2 trouble @Inject-ing FirebaseMessagingService -

i tried migrate application i'm working on gcm fcm . while doing so, found i'd been using dagger 2 (2.0.2) provide instances of retrofit apis , other user-data managers inside service (with no problems), no longer firebasemessagingservice . whenever i'd try compile subclass of firebasemessagingservice listed in dagger 2 component interface, i'd illegalargumentexception . after digging through code, seems exception thrown when dagger 2 tries validate class name , finds first letter isn't uppercase. firebasemessagingservice , @ least on end, inherits uglified / minified codebase, , immediate superclass zzb ( public class firebasemessagingservice extends com.google.firebase.iid.zzb ). my best guess culprit. if problem, i'm not sure aside stick gcm now. have ideas or similar experience this? edit: got chance ask 1 of firebase developers issue: https://www.reddit.com/r/androiddev/comments/4upj1o/beware_of_the_new_firebase/d5tdbk3 - no resolution.

c - socket() function from nacl sdk returns -1 -

i have build chrome app nacl module calls socket() function, function returns -1. have compiled module -lnacl_io linker option. have tried run goolgle chrome --allow-nacl-socket-api=localhost . call function next arguments: socket(af_inet, sock_stream, ipproto_tcp) why function failed? don't forget call nacl_io_init_ppapi function

javascript - Query string of the URL getting removed in mobile for HTML's <a> tag -

this strange issue - have simple html anchor tag below (ofcourse not code, there more). works great laptop browsers in samsung note browser when click (exact url not google's application's url) query string part automatically gets removed/truncated , left url without query string opened in new window. <a id="gog" href="http://localhost/webcontent/index.jsp?abc=abc" target="_blank" rel="noreferrer">google</a> originally, href value building dynamically in href attribute itself, though mobile doesn't allow computed full url separately , used variable in href didn't help. then thought may rel="noreferrer" causing issue no avail. this happens in mobile device - samsung , chrome browser, laptop chrome fine. anybody has ever faced issue or idea on how resolve. your url malformed; need / between host portion , path / querystring. also, make url work, should change /search

python - Matplotlib get coordinates of top and bottom of horizontal bar edges -

given sample horizontal bar chart: """ simple demo of horizontal bar chart. """ import matplotlib.pyplot plt plt.rcdefaults() import numpy np import matplotlib.pyplot plt # example data people = ('tom', 'dick', 'harry', 'slim', 'jim') y_pos = np.arange(len(people)) performance = 3 + 10 * np.random.rand(len(people)) error = np.random.rand(len(people)) plt.barh(y_pos, performance, xerr=error, align='center', alpha=0.4) plt.yticks(y_pos, people) plt.xlabel('performance') plt.title('how fast want go today?') plt.show() how can y coordinates of top edge of top bar , bottom edge of bottom bar (assume bar chart axis, this: ax.barh...). thanks in advance! every bar rectangle object: br = plt.barh(y_pos, performance, xerr=error, align='center', alpha=0.4) b in br: print b w,h = b.get_width(), b.get_height() # lower left vertex x0, y0 = b.xy # lower r

encoding - how to convert from base64 to string by hand -

i looking steps follow convert base64 password string hand, thing find online-tools decrypt-encrypt. https://www.base64encode.org/ they have explanation @ bottom. read rfc 4648: https://tools.ietf.org/html/rfc4648 you need know ascii codes characters want encode, how bits , on .. also 3x8 bits create 4x6 bits, might learn direct conversion 3/4 positions if nerdy enough. :) cool question, wondered how it's done never checked, thx!

Share data with friends on Firebase -

i developing app needs server backend sync data between devices , friends. while researching if should make own server (which i'd prefer not to) stumpled upon firebase. what haven´t figured out how public data is. how understood it, whatever send seen every user of app. saw can define rules "the user needs logged in", can specify child should visible user created it? , then, there way invite other user collaborate on child? creator , invited user can see child? my app running on ios in beginning, guess thats not relevant question, it? yes can that, can set security rules allow user specific uid (firebase user id) write or read data example... "users": { "$uid": { ".read": "auth != null && auth.uid == $uid" } } also custom authentication can create custom claims grant different access levels (for example admin, editor..etc) example... "frood": { // towel massively useful thing int

node.js - npm ERR! EEXIST - Not able to deploy a SailsJS app to Openshift -

i new openshift , sailsjs any pointer move forward welcome. i have created simple sails app e.g. sails new myapp , , followed openshift deployment instruction here package.json in package.json have tried both node app.js , sails lift start app. "scripts": { "debug": "node debug app.js", "start": "node app.js" }, "dependencies": { "ejs": "2.3.4", "grunt": "0.4.5", "grunt-bower": "^0.21.2", "grunt-bower-task": "^0.3.4", "grunt-cli": "^1.2.0", "grunt-contrib-clean": "0.6.0", "grunt-contrib-coffee": "0.13.0", "grunt-contrib-concat": "0.5.1", "grunt-contrib-copy": "0.5.0", "grunt-contrib-cssmin": "0.9.0", "grunt-contrib-jst": "0.6.0", &q

html - CSS to display table row headers above data cells -

Image
suppose have table on html page, purple border around th cells , green border around td cells: some code produces (the css view-small class isn't in use in above display it's explained): <meta http-equiv="x-ua-compatible" content="ie=edge"> <title>table transformation</title> <link href='https://fonts.googleapis.com/css?family=open+sans:400,400italic,700,700italic' rel='stylesheet' type='text/css'> <link href='https://fonts.googleapis.com/css?family=open+sans+condensed:300,300italic,700' rel='stylesheet' type='text/css'> <style> body { font-family: "opens sans", sans-serif; } td { border: 1px solid green; } th { border: 1px solid purple; } .view-small table { display: block; width: 100%; } .view-small tbody { display: block; } .view-small tr { display: block; width: 100%; margin: 2em auto; position; relative; } .view-small th { display: block; width

Dynamically add various controls to scrollview (iOS/Swift) -

Image
i'm working on web application allows users customize fields want retrieve users. example, text, numbers, booleans, popups. because unknown amount of controls need decided create reference scrollview. tried adding button test can't figure out how button show up? when view page see white. how add dynamic controls scrollview? things tried: made sure autolayout correct scrollview. the addsubview code below. import uikit class taskdetailviewcontroller: uiviewcontroller { @iboutlet weak var thescrollview: uiscrollview! override func viewdidload() { super.viewdidload() // additional setup after loading view. //self.view.addsubview(uibutton) let cellbutton = uibutton(frame: cgrectmake(5, 5, 50, 30)) cellbutton.settitle("hello", forstate: uicontrolstate.normal) thescrollview.addsubview(cellbutton) } override func didreceivememorywarning() { super.didreceivememorywarning() /

java - Calling outer class' syncronized method from inner class -

i have program looks in essence this class outer { class inner implements runnable { public void run() { dosomething(); } } public synchronized void dosomething() { //... } } which lock inner.run() acquire when calling dosomething() ? identical synchronized(inner.this) or synchronized(outer.this) ? thanks lot in advance. the receiver invocation of dosomething() within run() outer.this . synchronized therefore lock monitor on object referenced expression. on computing target reference in method invocation expression , jls says otherwise, let t enclosing type declaration of method member, , let n integer such t n'th lexically enclosing type declaration of class declaration contains method invocation. target reference n'th lexically enclosing instance of this. t here outer , since that's class declares it. n 1, outer enclosing type declaration of inner . target reference the

MySQL Query To Select Closest City -

i trying repeat following query rows. trying map closest city (based on latitude , longitude) places latitude , longitude. have table places contains places need mapped, , table citytable places matched to. have following query works single row: select p.placeid, p.state, p.city, p.county, p.name, sqrt(pow((69.1 * (p.lat - z.latitude)), 2 ) + pow((53 * (p.lng - z.loungitude)), 2)) distance, p.lat,p.lng,z.latitude,z.loungitude,z.city places p,citytable z p.placeid = 1 order distance asc limit 1; this works single location. need remove constraints apply entire table.the problem encountering seems want make copy compare every other element in table. example, if there 100 rows in p , 100 rows in z, resulting table seems 10,000 rows. need table of size count(*) p. ideas? also, there more efficient ways if table p contains on million rows? thanks. you can find nearest city place using: select p.placeid, p.state, p.city, p.county, p.name,

What are the valid parameters date offset strings in pandas? -

various pandas functions allow argument specify frequencies, e.g. freq in pd.date_range('1/1/2011', periods=72, freq='h') (source) and first argument in series.resample('3t', how='sum', label='right') (source) i can figure out empirically h , 3t mean, if want create own frequencies i'm stuck. these parameters, , how can find out how form own? the valid frequency codes can found in documentation under offset aliases . next sections, combining aliases , anchored offsets , relevant. essentially, number see preceding offset alias multiplier offset alias. example, t means minutely, 3t means every 3 minutes. pd.date_range('2015-01-01', periods=3, freq='t') datetimeindex(['2015-01-01 00:00:00', '2015-01-01 00:01:00', '2015-01-01 00:02:00'], dtype='datetime64[ns]', freq='t') pd.date_range('2015-01-01', periods=3, freq='3t') datetimeindex([&

javascript - Finding the coordinates of a node in D3.js -

i trying x , y coordinates nodes, , use coordinates draw straight line 1 node if edge has been specified straight: (var x = 0; x < edges.length; x++) { // check if nodes exist edge var nodefrom = nodes.filter(function(item:any) { return item.id === edges[x].from; }); var nodeto = nodes.filter(function(item:any) { return item.id === edges[x].to; }); var currentstyle; var currentarrowheadstyle; if (edges[x].shape === "straight") { edges[x].shape = svg.selectall("g.edgepath").data(edges).enter().append("line"); } my node object looks this: { id: 1, shape: "ellipse", label: "start"}, { id: 2, shape: "rect", label: "square"}, { id: 3, shape: "diamond", label: "split (a)", class: "completed"}, { id: 4, shape: "rect", label: "square (a)", class: "in-progress"},

Why won't my jquery work -

i have more code important bit. rest of js function , styling. <button onclick="gb()" id="gb"> clickme</button> <script src="jquery-1.12.2.min.js"> $( document ).ready(function() { $('button').eq(0).trigger('click'); }; you can't mix <script> tag src and inner script. make 2 tags <script src="jquery-1.12.2.min.js"></script> <script> // script </script> also, check console while developing. point out errors you.

c++ - Interval for bisection method -

i've been assigned project determine square root of number without using division or math.h library. upon doing own research i've decided tackle problem using bisection method. used pseudo code portion bisection wikipedia page: https://en.wikipedia.org/wiki/bisection_method#example:_finding_the_root_of_a_polynomial to setup algorithm. my code #include <iostream> #include <cmath> #include <stdlib.h> using namespace std; void __attribute__((weak)) check(double alt_sqrt(double)); //default check function - definition may changed - not graded void __attribute__((weak)) check(double alt_sqrt(double)) { if(alt_sqrt(123456789.0) == sqrt(123456789.0))cout << "pass\n"; else cout << "fail\n"; return; } //change definition - graded different check function double my_sqrt(double x) { int = 0; double = 0.0; // lower bound double b = x + 1; // upper bound double c = 0.0; //

Odd case in Java generics - should class level generic affect getters? -

this question has answer here: what raw type , why shouldn't use it? 12 answers why calling method generic return on generic class considered unsafe javac? 4 answers i came across weird case while writing unit test today (simplified below). import java.util.collection; import java.util.collections; public class test { public static class testclass<t> { private final collection<string> field = collections.emptylist(); public collection<string> getfield(){ return this.field; } } public static void main(string[] args){ // unchecked assignment, why? testclass case1 = new testclass(); collection<string> field1 = case1.getfield(); // ok testclass case2 = new testc

python - Moviepy zooming effects need tweaking -

Image
i zoom clip dimension, stop further zooming. in other words, clip stop further increasing size after reaching size, , better if clip start zooming smaller of original size, , bigger version. using moviepy module. following code can progressively zoom clip, having hard time figuring out how grow clip small big, creating animated effect. feedback provide appreciated. import os moviepy.editor import * screensize = (640,360) clip = (imageclip(img) .resize(height=screensize[1]*4) .resize(lambda t : 1+0.02*t) .set_position(('center', 'center')) .set_duration(10) ) i having hard time figuring out how write function in order create type-writing effect moviepy's txtclip, meaning letters within clip shown 1 after another, creating smooth type-writer animation text. moviepy got helpful classes such findobjects--which can detect individual letters out of clip: txtclip = textclip('cool effect',color='white', fon

Not able to locate log4j.properties in IntelliJ -

i not able locate file log4j.properties in java using intellij ide. have tried creating properties folder resource bundle nothing. tried copying everywhere, looks need add classpath or else won't work. i know can create file custom path , give file object propertyconfigurator.configure(file file). but want know how create property folder in intellij , add classpath. in eclipse straight forward process, idea not able do. using intellij 2016. thanks,

Convert following code for 3d plot in MATLAB into code for Gnuplot? -

i have following 3d plot in matlab i'm trying plot in gnuplot don't know how to. in matlab, x,y,z matrices calculated inside nested loop, plotted: w = 50 ; ww = 0:1:w ; d = 100 ; dd = 0:1:d ; i=1:1:length(ww) j=1:1:length(dd) x(i,j) = dd(i) ; % need refer array dd y(i,j) = dd(j) ; z(i,j) = <a complicated function ommitted simplicity> end end plot3(x,y,z) how plot above in gnuplot? need arbitrary values of w , d . understand need splot function @ loss how implement calculation of x,y,z matrices. appreciated! edit: seems above can done using array , word keywords/function haven't been able implement yet in gnuplot, set ranges , plot function: set xrange [0:50] set yrange [0:100] z(x,y) = exp(-(x**2 + y**2)/100.0) splot z(x, y) if want change grid, use set isosamples that, like set isosamples 51,101

html - Css Dropdown menu having difficulties -

Image
i working on website im having problems dropdown menu. when put mouse on menu, wont show child nav. main_nav codes: .column { display: inline-block; vertical-align: top; font-size: 14px; line-height: 1.2; } #main_navigation { display: inline-block; list-style-type: none; margin: auto; padding: 0; overflow: hidden; border: 1px solid #e7e7e7; background-color: #f3f3f3; text-align:center; margin: auto; } #main_navigation li { margin-top: 12px; font-size: 15px; line-height: 17px; color: #333; letter-spacing: 0px; font-family: 'crimson text' font-weight: normal; display:inline-block; position: relative; } #main_navigation li { display: block; color: #666; text-align: center; padding: 14px 16px; text-decoration: none; } and dropdown: .dropbtn { color: white; padding: 16px; font-size: 16px; border: none; cursor: pointer; } .dropdown { position: relative; display: inline-block; } .dropdown-content { d

osx - bower install fails giving me EACCES: permission denied error -

i following error below when running npm install -g bower . node version v6.2.0 npm version 3.9.3 osx yosemite /usr/local/lib/node_modules/bower/lib/node_modules/configstore/index.js:54 throw err; ^ error: eacces: permission denied, open '/users/xxx/.config/configstore/bower-github.json' don't have access file. at error (native) @ object.fs.opensync (fs.js:634:18) @ object.fs.readfilesync (fs.js:502:33) @ object.create.all.get (/usr/local/lib/node_modules/bower/lib/node_modules/configstore/index.js:35:26) @ object.configstore (/usr/local/lib/node_modules/bower/lib/node_modules/configstore/index.js:28:44) @ readcachedconfig (/usr/local/lib/node_modules/bower/lib/config.js:19:23) @ defaultconfig (/usr/local/lib/node_modules/bower/lib/config.js:11:12) @ object.<anonymous> (/usr/local/lib/node_modules/bower/lib/index.js:16:32) @ module._compile (module.js:541:32) @ object.module._extensions..js (module.js:550:10) sudo c

nginx - api gateways. how are they written and is there guideline for how they interact with its clients. -

i've been doing ton of research on microservices cannot find single piece of code written api gateway. understand between clients , services have api gateway allows client make 1 requests on iot gateway , gateway can make many requests internally services build response. article on nginx the api gateway responsible request routing, composition, , protocol translation. use case suppose support 2 clients. android , angular app (browser) , let's make tangible user story client online shopping store. the shopping store have different services broken out servers , each service built on different platform/language different database. self contained can scale in cloud without having scale entire application. if there intense algorithm needs run payment. payment services can spin few more servers balance load , decrease user wait time. but written in java have http/rest exposed api consumed. if it's written in c++/golang/node doesn't matter language, instead

hive - Extra backslash in Sqoop import result -

currently i'm using sqoop import data hp vertica database hive, column special character, result different data in vertica db, here code: sqoop import --driver com.vertica.jdbc.driver --connect jdbc:vertica://db.foo.com/corp \ --username xx --p --where 'src_sys_cd=xxx' --null-string '\\n' --null-non-string '\\n' \ --m 1 --fields-terminated-by '\001' --hive-drop-import-delims --table addr \ --target-dir /xxxx/addr data in vertica db: src_sys_cd ctry_cd addr_id addr_typ_cd addr_str_1_lg_nm 123456 nz 107560 null c\ - 108 waiatarua road data showed in hive db: src_sys_cd ctry_cd addr_id addr_typ_cd addr_str_1_lg_nm 123456 nz 107560 null c\\ - 108 waiatarua road the difference in column addr_str_1_lg_nm, after sqoop importing, 1 backslash(\) added. while other column not have backslash (\) not changed. since there null in vertica, must use --null-string '\\n' --null-non-string 

Add custom python logging lvlname -

i'm used using log levels using following standard logging methods: logging.info('info message') logging.debug('debug message') and have formatter following stream_formatter = logging.formatter('%(asctime)s - %(levelname)s - % - %(message)s') so log looks like: 2016-06-01 23:18:42,602 - info - info message 2016-06-01 23:18:42,700 - debug - debug message i want create new logging level follows: logging.log(15, 'new level') how print like: 2016-06-01 23:18:42,800 - custom_level - new level found in documentation there public method in logging module: logging.addlevelname(lvl, levelname) custom_level = 15 logging.addlevelname(custom_level, 'custom_level')

python - The D+J programming challenge from Kattis -

Image
the problem follows: dick d=12 years old. when this, mean @ least twelve , not yet thirteen years since dick born. dick , jane have 3 pets: spot dog, puff cat, , yertle turtle. spot s years old when puff born; puff p years old when yertle born; spot yy years old when yertle born. sum of spot’s age, puff’s age, , yertle’s age equals sum of dick’s age (d) , jane’s age (j). how old spot, puff, , yertle? the input's given s,p,y,j , output required is: spot's age, puff's age , yertle's age. my solution follows: import sys import math d = 12 line in sys.stdin: line = [int(x) x in line.strip("\n").split()] s = line[0] p = line[1] y = line[2] j = line[3] yertle = (d+j-y-p)/3.0 difference = yertle - math.floor(yertle) if difference > 0.5: # 0.66666 cases spot = puff = int(math.ceil(yertle+p)) yertle = int(math.floor(yertle)) else: # 0.33333 cases yertle = i

OpenERP customers separation -

please know ho separate customers in category, since have 2 type of customers, first group should appear in crm->customers , vice versa avoid having huge list of customers when searching. my first attempt add tag different customers separate them, example crm customers have tag name mass mailing correct achieve tags ?? , second question how set default search keyword example if click on sales -> customers how set default value of search box example crmonly tag thanks. you can use "domain" ever want have such separation.

Is it possible to override a rails engine model association in a decorator? -

i'm using rails engine defines class following relation: module blogit class post < activerecord::base ... belongs_to :blogger, :polymorphic => true ... end i'm trying override association in decorator file. namely, not want association exist if possible. in decorator file, i'm using class_eval extend class definition. blogit::post.class_eval ... end but can't seem override or destroy relation. know how this?

excel - change the value of a cell through time with the next item in column -

i know if there way change value of cell every 10 seconds. new value next cell in column , forth until went through none-blank cells. you can use application.ontime function call function every 10 seconds: dim integer function starttimer() 'set counter 1 = 1 'call function timerfunction end function function timerfunction() 'write current time column sheets("table1").cells(i, 1).value = format(now, "hh:mm:ss") 'if counter = 10, stop timer if = 10 exit function end if = + 1 'call function delay of 10 seconds application.ontime + timevalue("00:00:10"), "timerfunction" end function so change if condition matches task. maybe this: if current column = last used column (if understood right)

jquery - Why doesn't isotope fill the row in this simple layout? -

Image
i have simple layout-- 3 colored boxes follow 1 after in code, designed fill fixed-width div . why doesn't isotope bring blue box next green box? goal have boxes fill of space possible. the code super straightforward: <style> .video { width:435px; height:265px; margin:20px; background-color:yellow; } .tweet { width:200px; height:165px; background-color:green; } .post { width:206px; height:260px; background-color:blue; } #iso { width:970px; border:solid 1px red; } </style> <div id='iso'> <div class='b video'></div> <div class='b tweet'></div> <div class='b post'></div> <div class='b video'></div> <div class='b tweet'></div> <div class='b post'></div> <div class='b video'></div> <div class='b tweet'></div> &

How to write physics equation in HTML -

Image
i'm having problem represent below physics equation using html tag so, how represent above equation html without using mathjax...?? in advance :) i have tried code : <table> <tbody> <tr> <td rowspan="2">a sin &omega;( t - </td> <td style="border-bottom:solid 1px">x</td> <td> )</td> </tr> <tr> <td>v</td> </tr> </tbody> </table> but don't know how make works hopefully this might set in right direction: <table> <tbody> <tr> <td>y = sin &omega;</td> <td style="font-size:200%">(</td> <td>t -</td> <td> <table> <tr> <td style="border-bottom:solid 1px black">x</td>

jquery - Add change event to element added after page load -

i'm using ajax add #it_selectcatlvl2 element in div #div_it_selectcatlvl2 , see when change value #it_selectcatlvl2 script doesn't work. code: $('#it_selectcatlvl2').change(function() { if($(this).val() > 0){ $('#it_submit').removeattr("disabled"); }else{ $('#it_submit').attr("disabled", "disabled"); } }); <div id="div_it_selectcatlvl2"> <select class="n_selectpath" style="" name="it_selectcatlvl2" id="it_selectcatlvl2"> <option value="0">change</option> <option value="1">one</option> </select> </div> use this: $('#div_it_selectcatlvl2').on('change', '#it_selectcatlvl2', function() { $('#it_submit').prop('disabled', !(this.value > 0)); }); your problem occurs because you're at

php - Unable to get DB::query() to work with variables from simpleXML -

i reading xml file, , using data create queries meekrodb. looks xml read , parsing, , confirmed variables doing simple echos. however, when build db::query() doesn't seem adding 'criteria_list' array query. here xml code: <?xml version="1.0" encoding="utf-8"?> <result> <product> <data> <field>spr_tech1</field> <value>s7</value> <criteria field="xfield_3"> <criteria_list>green</criteria_list> <criteria_list>beige</criteria_list> </criteria> </data> <data> <field>spr_tech1</field> <value>s1</value> <criteria field="xfield_3"> <criteria_list>red</criteria_list> <criteria_list>blue</criteria_list>

javascript - Linking keys to code -

i'm quite new programming (started yesterday) , far i've created simple code. unaware on how make can click enter , submit forum post commands on how make possible appreciated :) <!doctype html> <html> <head> <title>title changing simulator!</title> <script type="text/javascript"> function substitute() { var myvalue = document.getelementbyid('mytextbox').value; if (myvalue.length == 0) { alert('please enter real value in text box!'); return; } var mytitle = document.getelementbyid('title'); mytitle.innerhtml = myvalue; } </script> </head> <body> <h1 id="title">title changing simulator!</h1> <input type="text" id="mytextbox" /> <input type="submit" value="click button" onclick="substitute()" /> </body> </html> wrap input , button in <form> , listen form's submit e

sap - Is it possible to load Hive data into Vora? -

i checked developer guide didn't find answer. far able load csv , orc files hdfs vora, able load hive? in absence of specifying hive source, tried use "paths" equal /apps/hive/warehouse/tablename/00000_0 (or whatever partial file name). however, if hive table represented multiple files in /tablename/ directory, i'd have explicitly list them in "paths", not ideal option. there better way? update: context question while vora doesn't provide data persistence, i'd use hive warehouse persistency layer, is, ultimately, still files, organization. using hadoop in sap ecosystem, utilize sap data services hive adapter load files outside hadoop (and dump data hadoop files, if required), , make data available via vora. there no automatic way load/migrate hive tables vora. creating vora tables based on (hive-organized) files in hdfs way go. the paths option allows use wildcard * load files particular directory in hdfs. works csv, parquet, orc

javascript - RegExp Object Literal notation vs Constructor notation difference -

this question has answer here: differences between javascript regexp literal , constructor 2 answers var digits = "b2"; var re = new regexp("/\d+/"); console.log(/\d+/.test(digits)); console.log("digits matches :", digits.match(re)); why digits.match(re) return null whereas .test returns true? when run digits.match("/\d+/"); correct answer. the new regexp() syntax doesn't use forward slashes / delimiter. it's assumed entire string regex. also, backslashes must escaped, since requirement of strings when aren't referencing escape character. these same: digits.match(new regexp("\\d+")); // 2 digits.match(/\d+/); // 2

Laravel .htaccess error when uploaded to the host -

your .htaccess file this <ifmodule mod_rewrite.c> <ifmodule mod_negotiation.c> options -multiviews </ ifmodule> rewriteengine on # redirect trailing slashes if not folder ... rewritecond% {request_filename}! -d rewriterule ^ (. *) / $ / $ 1 [l, r = 301] # handle front controller ... rewritecond% {request_filename}! -d rewritecond% {request_filename}! -f rewriterule ^ index.php [l] # handle authorization header rewritecond% {http: authorization}. rewriterule. * - [e = http_authorization:% {http: authorization}] </ ifmodule> somehow hosts 500 internal server error the correct .htaccess should this: <ifmodule mod_rewrite.c> <ifmodule mod_negotiation.c> options -multiviews </ifmodule> rewriteengine on # redirect trailing slashes if not folder ... rewritecond %{request_filename}! -d rewriterule ^(.*)/$/$1 [l,r=301] # handle front controller ... rewritecond %{request_filename}! -d rewritecond %{request_filenam

Exceute SP with out parameter using Dapper always get null value (Dapper+ODBC+Sybase) -

Image
i have problem executing sp dapper using odbc sybase, input parameter not have problems, when tried out parameter not working expected. original sp have insert statement put transaction statement in code. here modified sp: create proc dbo.sp_test_dapper(@first_parm varchar(10), @errormessages varchar(1000 ) out ) begin declare @rtn int declare @tranname varchar(50) select @tranname = 'sp_test' begin transaction @tranname if @first_parm = '1' begin select @errormessages = 'ok' end begin select @errormessages = 'error' goto error_trap end commit transaction @tranname select @errormessages error_trap: rollback transaction @tranname select @errormessages end my result: your implementation odbc named parameters incorrect. encase named parameter question marks in statement , create named parameter without question marks. question marks used dapper

mysql - CPU High Load because of search engines mass crawling -

i have server containing many web sites, , when sites have huge updates, search engines : bing (specially), yandex, yahoo come server using many ip addresses , don't attention cpu load , mysql queries , try fetch web pages in same time, so how can limit them whole server currently blocked these search engine ips thank you you have create robots.txt search engine read , know not allowed index (crawl) whatever specify on it. for bing, instance, here guide: https://www.bing.com/webmaster/help/how-to-create-a-robots-txt-file-cb7c31ec

email - Really weird Php Mail::factory Issue -

i have weird issue troubled , not know how fix it! sample code used here wroks , sends me email correctly! <?php require_once "mail.php"; $from = "web master <contact@sample.com>"; $to = "bob <sample@sample.com>"; $subject = "test email using php smtp\r\n\r\n"; $body = "this test email message"; $host = "mail.emailsrvr.com"; $username = "sample@sample.com"; $password = "11111"; $headers = array ('from' => $from, 'to' => $to, 'subject' => $subject); $smtp = mail::factory('smtp', array ('host' => $host, 'auth' => true, 'username' => $username, 'password' => $password)); $mail = $smtp->send($to, $headers, $body); if (pear::iserror($mail)) { echo("<p>" . $mail->getmessage() . "</p>"); } else { echo("<p>message sent!</p>&quo

ios - Swift Trie levenshtein distance search -

i've built trie data structure looks this: struct trie<element : hashable> : equatable { private var children: [element: trie<element>] private var endhere: bool } to perform autocorrection operations on input uitextfield . gave trie variety of functions such insert: /** private insert function. inserts elements trie using sequences' generator. - parameter g: `generatortype`. */ private mutating func insert<g: generatortype g.element == element>(g: g) { var gen = g if let head = gen.next() { if case nil = children[head]?.insert(gen) { children[head] = trie(g: gen) } } else { endhere = true } } /** insert elements trie. - parameter seq: sequence of elements. */ mutating func insert<s: sequencetype s.generator.element == element>(seq: s) { insert(seq.generate()) } the necessary initializers: /** create empty trie. */ init() { children = [:] endhere = false }

Zip files and delete them in base perl -

i want zip files of length , delete them once zipping successful. doing deletion of files not zipped. using below code. deleting part working fine zipping not happening. i using base perl , can't use modules archive::zip , io:compress::zip . sub actiononfile { my($filearray_ref, $action, $directory, $zipname) = @_; @filearray = @$filearray_ref; $action = uc($action); #set action string uppercase $cdt = &currentdatetime; foreach $filename (@filearray) { if ($action eq "zipdel") { # zip , delete file $zipcommand = "wzzip -p -m \"$directory\\$zipname.$cdt.zip\" \"$directory\\$filename\""; open zip_process, "$zipcommand |" or $rcode=5; print logfile " error: opening zip delete process $filename: $! $?\n" if ($rcode == 5 || $!); while (<zip_process>) { $rcode=3 if (

LDAP authentication using scala or java -

i've created ldap server on machine , created 1 user admin inside ldap server , can access url http://192.158.2.136/phpldapadmin , i've login page in application , want when enters username , password want application validate user ldap server i.e should check whatever username , password entered same exists in ldap server or not.so far tried apacheds-all couldn't find proper way send username , password server, can please tell me how in java or scala , should able validate user credentials ldap server using java or scala client code.thanks in advance!! i got solution : object ldapvalidations { def validateforldap(username: string, passcode: string): boolean = { val result = try { var props = new properties props.put(context.initial_context_factory, "com.sun.jndi.ldap.ldapctxfactory") props.put(context.provider_url, "ldap://192.168.1.121:389") props.put(context.security_principal, s"cn=$username,cn=staff,dc=myreutore,d