Posts

Showing posts from January, 2013

Way to Create Keyboard Shortcuts for Google Search Results? -

i wondering if knows way create keyboard shortcuts google search results. instance, i'm looking way open first google search result number 1, on keyboard, , each successive entry opened next number. i've searched high , low ways this, haven't gotten closer. ways/extensions/languages can use carry out feature? at least, wondering if can point me in direction of resources or ways program this. have tampermonkey extension downloaded chrome extension, haven't been able create or find appropriate js code want. example of i'm looking can found here: http://googlesystem.blogspot.com/2007/02/keyboard-shortcuts-for-google-search.html . unfortunately, scripts , links found there dead , incredibly old (from 2007). this idea got me interested, here's basic implementation tampermonkey works on google domains via special .tld domain available userscripts. // ==userscript== // @name google digits // @include https://www.google.tld/* // @run-at

scala - How to catch exceptions when using DataFrameWriter to write dataframe with JDBC -

i writing dataframe mysql database. database throwing java.sql.batchupdateexception: duplicate entry 'qwer1234' key 'transaction_id_unique' . the code using write database is txnsdf.write.mode("append").jdbc(connprop.getproperty("url"), query, connprop) now can't write try catch around because not on row level , looking @ org.apache.spark.sql.execution.datasources.jdbc.jdbcutils class inserts batches of 1000 transactions @ time. i remove constraint on database doesn't solve problem of handling exceptions coming class. my last option, partially rewrite savepartition method in jdbcutils handle exception , don't want that. suggestions?

eclipse - Out put in console -

package lesson1; public class starprogram { public static void main(string[] args) { // todo auto-generated method stub for(int i=1;i<=3;i++){ for(int j=1;j<=3;j++) { system.out.println("*"); }system.out.println(); } } } for program, getting out put * * * * * * * * * but should right?: * * * * * * * * * what problem in program? this may you. read difference between system.out.print , system.out.println change for(int j=1;j<=3;j++) { system.out.print("*"); }system.out.println(); instead of for(int j=1;j<=3;j++) { system.out.println("*"); }system.out.println();

c++ - Relationship between dwPageSize and dwAllocationGranularity -

i’m reading google’s tcmalloc source code (the windows porting). int getpagesize() { static int pagesize = 0; if (pagesize == 0) { system_info system_info; getsysteminfo(&system_info); pagesize = std::max(system_info.dwpagesize, system_info.dwallocationgranularity); } return pagesize; } as can se in code snippet above pagesize (that unit of allocation) calculated max between dwpagesize , dwallocationgranularity. mean know kind of relationship between these 2 values: necessary calculate value in way here upside explicated? , there situations in dwpagesize greater dwallocationgranularity? disclaimer: answer not based on documentation on interpretation of these constants. i assume page size correctly reported. assume allocation granularity refers granularity of os memory allocation interface. there these 2 cases consider: the allocation granularity greater page size. allocating memory block of size of page lead larger al

asp.net - Regexing an email with national chars -

i trying build web site friend of mine. found nice article contact-form. in article usage of regex validation of emails explained (as anti-hacking tool). idea tried this: <asp:regularexpressionvalidator validationexpression="^([\w\-\.\+\~]+\@[\w\.\-\!]+)$" runat="server" controltovalidate="email" cssclass="text-danger" errormessage="invalid email." ></asp:regularexpressionvalidator> it works expected when gets usual emaile me@master.com . want allow national special chars ç or Ă© , email snÄ›hurka@trpaslĂ­ci.cz through. the reason behind fact in country (czech republic) (was?) motion allow characters punctuation in url addresses (see http://háčkyčárky.cz - czech web discussing this; idea named idn - internationalized domain names - google-magic). far know didn´t got through, knows future holds? so, please, know way how improve regex national characters in mind? (yeah, suppose not standard-compliant, not care it.

.net - Azure AD Graph API $filter not working with spaces -

Image
i want filter groups based on displayname . this works: https://graph.windows.net/x.onmicrosoft.com/groups?$filter=displayname%20eq%20'programmers'"&api-version=2013-11-08 this doesn't: https://graph.windows.net/x.onmicrosoft.com/groups?$filter=displayname%20eq%20'web%20developers'api-version=2013-11-08 note space in web%20developers . groups without space work, groups space not. what doing wrong? thanks! https://graph.windows.net/x.onmicrosoft.com/groups ?$filter=displayname%20eq%20'web%20developers'api-version=2013-11-08 please check request url carefully. think there wrong it. need add '&' in part 'web%20developers'api-version=2013-11-08 i have tested on local api-version 1.6. space in group name not affect our result. see more detailed information following screenshot:

java - JLabel#setIcon in javafx -

i have swing code base, using lot of new jlabel().seticon() snippets. i'm trying migrate app javafx, have no idea on how since there no such method using javafx label object. any ideas? use label setgraphic of node (like imageview ). @james_d commented. as jlabel can add "graphic" (image) constructor. what misleading different api terminology, , abstract node child of label .

javascript - About badly documented patreon-js -

i don't understand documentation, tried hard mentioned info below not quite sure "jsonapiurl" is. can tell me how achieve goal in quote. response format you can request specific related resources , or resource attributes want returned our api, per json:api specification. lists of valid includes , fields arguments provided in patreon/schemas. instance, if wanted request total amount patron has ever paid campaign, not included default, do : const patreonapiclient = patreonapi(access_token) const url = jsonapiurl(`/current_user`, { fields: { pledge: [...pledge_schema.default_attributes, pledge_schema.attributes.total_historical_amount_cents] } }) patreonapiclient(url, callback) more info below https://github.com/patreon/patreon-js

python - How to print the \n character in Jinja2 -

i have following string in python: thestring = "123\n456" in jinja2 template, use {{thestring}} , output is: 123 456 the way can jinja2 print exact representation 123\n456 (including \n ) escaping thestring = "123\\n456" . is there other way can done directly in template? i'll answer own, maybe helps has same question. this works: {{thestring.encode('string_escape')}}

java - Android Implement AsymmetricGridView -

hello have problem implementation of assymetricgridview still crashing dont know wrong how implement correctly adapter there error link assymetricgridview library. thank you adapter must instance of asymmetricgridviewadapter @ com.felipecsl.asymmetricgridview.library.widget.asymmetricgridview.setadapter(asymmetricgridview.java:71) @ com.gabriel.movies.fragment.mainfragment.render(mainfragment.java:140) @ com.gabriel.movies.fragment.mainfragment$mytask.onpostexecute(mainfragment.java:228) @ com.gabriel.movies.fragment.mainfragment$mytask.onpostexecute(mainfragment.java:161) my code <com.felipecsl.asymmetricgridview.library.widget.asymmetricgridview xmlns:android="http://schemas.android.com/apk/

local storage - How do I keep the current tab active with twitter bootstrap after a page reload? With typescript? -

Image
i want how keep current tab active twitter bootstrap after page reload? of type script.how can this.my issue same :- [1]: how keep current tab active twitter bootstrap after page reload? want typescript.how can i? but want typescript.how can i lucky typescript superset of javascript : https://basarat.gitbooks.io/typescript/content/docs/javascript/recap.html so code sample https://stackoverflow.com/a/10524697/390330 works just fine // bootstrap 3 use 'shown.bs.tab', bootstrap 2 use 'shown' in next line $('a[data-toggle="tab"]').on('shown.bs.tab', function (e) { // save latest tab; use cookies if 'em better: localstorage.setitem('lasttab', $(this).attr('href')); }); // go latest tab, if exists: var lasttab = localstorage.getitem('lasttab'); if (lasttab) { $('[href="' + lasttab + '"]').tab('show'); } note: didn't use wrapping function hope

html - Make div appear intermittently using Animation css property not working -

my goal have 4 colorful squares opacity goes 0 1 intermittently show loading. i used css animation property (see below) achieve - doesn't work! css animation: opacity 1.5s infinite 200ms i have implemented on codepen . can tell me how fix it? this because have no keyframe animation assigned "opacity" animation. need create keyframe animation work: (i changed animation name "fade" instead of "opacity") css .loader-block:nth-child(1) { background: red; animation: fade 1.5s infinite 100ms; } ... @-webkit-keyframes fade { {opacity: 1;} {opacity: 0;} } @keyframes fade { {opacity: 1;} {opacity: 0;} } codepen ps: should close out of css properties semicolon ( ; ). noticed there few missing.

for loop - how can I find the place of some numbers in a Matlab matrix? -

i have matrix values -180 180 , want find places each value , save them in new matrix, how can it? i want create loop goes values -180:1:180 , finds locations(i,j) each value. e.g want find locations value -180 , save them in new matrix. possible done? wrote here code loop function , works don't know how save values know location each value. for a= 180:-1:-180 [i,j]=find(orient==a) end so many ways this.assuming orient matrix, use cells store i's , j's, like: orient=round(180.*(2.*rand(100,100)-1)); %or whatever find_results=cell(361,2); a=-180:1:180; index=1:length(a) [i,j]=find(orient==a(index)); find_results{index,1}=i; find_results{index,2}=j; end not elegant or efficient, works fine me. know wantted use matrix, cant freely choose length of each column in matrix, think do. otherwhise go like find_results(index,1:length(i))=i; but need first create matrix end filled zeros,because way work make sure size(find_result,1)=nu

ember.js - three.js animations in ember js -

how should create render loop of three.js animations in ember js. code have till import ember 'ember'; export default ember.controller.extend({ scene: new three.scene(), camera: new three.perspectivecamera(75, window.innerwidth/window.innerheight,1,500), renderer: new three.webglrenderer(), init: function() { this.renderer.setsize(window.innerwidth, window.innerheight); document.body.appendchild(this.renderer.domelement); this.renderpreloader(); }, renderpreloader:function() { var geometry = new three.boxgeometry( 1, 1, 1 ); var material = new three.meshbasicmaterial( { color: 0x00ff00 } ); var cube = new three.mesh(geometry,material); this.scene.add(cube); this.camera.position.set(2,2,2); this.camera.lookat(cube.position); this.renderer.render(this.scene,this.camera); this.renderloop(); }, renderloop: function() { requestanimationframe(this.renderloop); this.camera.position.x = this.camera.position.

css3 - how to flip an image smoothly when hovered using css? -

i trying flip image when hovered on using css3 animations. problem rotation not @ smooth , many bugs there in it. please me solve problem. here css code .rotate { transition:transform 0.7s; transition-timing-function : ease-in-out; } .rotate:hover { opacity :100%; transform:rotatey(180deg); } .back { visibility : hidden; text-align : center; position:absolute; top:0; bottom:0; left:0; right:0; opacity:0; transform:rotatey(180deg); background-color: lightgray; border-color:white; padding-top:40px; } .rotate:hover .back { visibility:visible; opacity:0.7; } you have use <figure> , <figcaption> elements... example: https://jsfiddle.net/e3xfj5ng/

python 3.x - When a Pandas Data Frame is Subset, does it need to be reindex? -

i making multi-plot using pandas dataframe , matplotlib. however, when alter dataframe , remove 1 of items error: valueerror: cannot reindex duplicate axis my initial code following , plots great, have group (plot) don't need: branchgroups = alldata['branchgroupings'].unique() fig2 = plt.figure(figsize = (15,15)) i,branchgroups in enumerate(branchgroups): ax = plt.subplot(3,3,i+1) idx = alldata['branchgroupings'] == branchgroups kmf.fit(t[idx], c[idx], label=branchgroups) kmf.plot(ax=ax, legend=false) plt.title(branchgroups) plt.xlabel('timeline in months') plt.xlim(0,150) fig2.tight_layout() fig2.suptitle('cumulative hazard function of employee groups', size = 16) fig2.subplots_adjust(top=0.88, hspace = .4) plt.show() in branchgroups there 7 items when print them out: ['branchmgr', 'banker', 'service', 'mdoandrsm', 'sbrmandbbrm','fc', 'de'] t

python - store dictionary in pandas dataframe -

Image
i want store a dictionary data frame dictionary_example={1234:{'choice':0,'choice_set':{0:{'a':100,'b':200,'c':300},1:{'a':200,'b':300,'c':300},2:{'a':500,'b':300,'c':300}}}, 234:{'choice':1,'choice_set':0:{'a':100,'b':400},1:{'a':100,'b':300,'c':1000}}, 1876:{'choice':2,'choice_set':0:{'a': 100,'b':400,'c':300},1:{'a':100,'b':300,'c':1000},2:{'a':600,'b':200,'c':100}} } that put them id choice 0_a 0_b 0_c 1_a 1_b 1_c 2_a 2_b 2_c 1234 0 100 200 300 200 300 300 500 300 300 234 1 100 400 - 100 300 1000 - - - 1876 2 100 400 300 100 300 1000 600 200 100 i think following pretty close, core idea convert dictionaries json , relying on pandas.read_json parse them. dictionary_example={

c - Sending to and receiving from different processes in MPI -

so i'm writing program bounce "virtual ball" between processes. root process i.e. task rank 0 initializes game , sends random process determined rand() % size (with random number generated seeded initial rank). i've tried doing: int rnk= rand() % size; mpi_send(&ball,1, mpi_int, rnk, mpi_comm_world); this sends ball next random process upon running code held blocking mpi_send. i've begun parallel programming don't have enough grasp of this. how send random process , further send random process? any pointers, tips, books , tutorials welcome. there issue here if root tries send (which can happen since rand()%size zero). if post receive first on root block never send call (as pointed out @gregor above); however, if post send first on root there no guarantee ever progress receive call mpi_send() not guaranteed asynchronous (i.e. implemented synchronous send wait forever matching receive). you need either ensure sender never sends

java - Why do I need to synchronize this variable -

i have 4 threads each trying find max value in linked list. this thread class: public class mythread extends thread { linkedlist<integer> list; int max = integer.min_value; public mythread(linkedlist<integer> list) { this.list = list; } public void run() { synchronized (list) { /* if don't synchronize list, nosuchelementexception @ list.remove() */ while (!list.isempty()) { int num = list.remove(); if (num > max) { max = num; } } } } } and here class main method: public class application { public static void main(string args[]) throws interruptedexception { linkedlist<integer> list = new linkedlist<integer>(); (int = 0; < 10; i++) { list.add(i); } mythread t1 = new mythread(list); mythread t2 = new mythread(list); mythread t3 =

javascript - angular can't access directive property -

i have following app directive: (function() { var app = angular.module('myfeed', []); app.directive("feedlist", function(){ console.log('in feed list directive'); return { restrict: 'e', templateurl: "/static/angular/phone-list/feed-list.template.html", cotrolleras: 'mycontroller', controller: function($http){ var data = $.param({ grant_type: 'password', username: 'test', password: 'test', client_id:'test', client_secret:'test', }); var config = { headers : { 'content-type': 'application/x-www-form-urlencoded;charset=utf-8;' } } $http.post('/o/token/', data, config) .success

android - Controlling nested ViewGroup size in a RelativeLayout: with wrap_content is still matching parent -

Image
i have widget uses percentrelativelayout position 4 imageviews inside it. need percent feature because i’m putting images along 4 sides of box different relative sizes: top child takes ~60 percent of height. have previewed layout , works great, no problem. widget wrap_content w , h (w don’t care much, h important, see.) i need widget inside larger layout. have parent relativelayout. layout should contain described widget @ top, buttons below it, in linear fashion: |--(group widget)--(text button)--(image button)—-| , ‘|’ indicates should snug parent. (the reason relative want float view @ bottom right.) so goal is: parent layout should sized predefined size (basically screen, although in full code there more above level - problem occurs isolating @ level), 2 buttons should calculate natural size , use it, percentrelativelayout @ top should take ‘remaining’ height , use children % sizing. in practice, screenshot shows (from layout preview tool) - percentrelativelayout sucks s

azure - why worker role instance is busy? -

i learning azure cloud services. deployed contosco cloud service ( https://azure.microsoft.com/en-us/documentation/articles/cloud-services-dotnet-get-started/ ) staging slot. ads worker role instance having problems (busy status). any tips on troubleshooting ? clicking on instance shows high level info. in non-azure application, looking @ event log useful. should following instruction : https://www.opsgility.com/blog/2011/09/20/windows-event-logs-with-windows-azure-diagnostics-and-powershell/ thanks,peter you should first check this link understand various lifecycles cloud service goes through. understanding written in onstart() method might cause, without code in question can't sure. can enable diagnostics (logs) using this , this links. so, see, line of code has executed , keeping cloud service busy.

php - WooCommerce - Custom notice on Thankyou and "My account" view order pages -

on woocommerce have custom field days_manufacture each product different (integer) values. also have code displays message on cart page highest value of "days of manufacture" : add_action('woocommerce_before_cart', 'days_of_manufacture'); function days_of_manufacture() { $day_txt = ' ' . __('day', 'your_theme_domain_slug' ); $days_txt = ' ' . __('days', 'your_theme_domain_slug' ); $text = __('your order produced in: ', 'your_theme_domain_slug' ); $max_days = 0; foreach( wc()->cart->get_cart() $cart_item ) if($cart_item['days_manufacture'] > $max_days) $max_days = $cart_item['days_manufacture']; if($max_days != 0) { if ($max_days == 1) $days_txt = $day_txt; $output = $text . $max_days . $days_txt; echo "<div class='woocommerce-info'>$output</div>"; }

angular - XHR error (404 Not Found) loading http://localhost:3000/traceur -

i'm getting following error when i'm trying use angular material in code. zone.js:101 http://localhost:3000/traceur 404 (not found)scheduletask @ zone.js:101zonedelegate.scheduletask @ zone.js:345zone.schedulemacrotask @ zone.js:282(anonymous function) @ zone.js:122send @ vm437:3fetchtextfromurl @ system.src.js:1156(anonymous function) @ system.src.js:1739zoneawarepromise @ zone.js:607(anonymous function) @ system.src.js:1738(anonymous function) @ system.src.js:2764(anonymous function) @ system.src.js:3338(anonymous function) @ system.src.js:3605(anonymous function) @ system.src.js:3990(anonymous function) @ system.src.js:4453(anonymous function) @ system.src.js:4705(anonymous function) @ system.src.js:408zonedelegate.invoke @ zone.js:332zone.run @ zone.js:225(anonymous function) @ zone.js:591zonedelegate.invoketask @ zone.js:365zone.runtask @ zone.js:265drainmicrotaskqueue @ zone.js:497zonetask.invoke @ zone.js:437 login:15 error: error: xhr error (404 not foun

How to play multiple video on top of each other with ffmpeg c programming -

i'm trying develop code can plays multiple videos simultaneously ffmpeg. need play video on 2x2 matrix background , video in top left corner of it. problem : top left corner video flicking , not stable enough. top-left video flicking while playing code : sdl_surface *screen = sdl_setvideomode(640, 480, 24, 0); void video_display(videostate *is) { sdl_rect rect; videopicture *vp; int w, h, x, y; h = screen->h; w = ((int)rint(h * aspect_ratio)) ; if(w > screen->w) { w = screen->w; h = ((int)rint(w / aspect_ratio)) ; } rect.x = (screen->w - w) / 2; rect.y = (screen->h - h) / 2; if( is->video_id == 0 ){ rect.w = w; rect.h = h; sdl_displayyuvoverlay(vp->bmp, &rect); // think problem on here } else if( is->video_id == 1 ){ rect.w = w/2; rect.h = h/2; sdl_displayyuvoverlay(vp->bmp, &rect); } when choose 0/1, move between audio only. question : should code in order make top-l

how to install Interceptor at Postman MAC app? -

i followed following steps: 1 install postman chrome web store (if don't have already!) 2 install interceptor extension. 3 open postman. 4 click on interceptor icon in toolbar , switch toggle “on” 5 browse app or website , monitor requests stream in. i see interceptor @ chrome postman, cant install @ mac app. tried restarting computer after install dint work. have latest version of chrome , postman. postman: version 4.7.0 (4.7.0) chrome: version 53.0.2785. is there other step need mac app postman? not sure mac native app linux native app (v.4.9.3) can use cookies when google chrome started (even if has interceptor disabled).

jquery - passing varibles into j-query from php as attributes -

i trying pass attribute location jquery unable 1 point out on m doing wrong php <?php echo "<a class='classloader' location='$array[$i]' href='#'>$array[$i]</a>"; ?> jquery <script type ="text/javascript"> $(document).ready(function () { var location= $(this).attr('location'); $(".classloader").click( function () { display(); } ); }); function display() { $('#contenthere').html(location); } </script> you're using $(this) outside click handler, doesn't refer element clicked on. then should pass string argument display() . $(".classloader").click(function() { var location = $(this).attr("location"); display(location); }); function display(str) { $('#contenthere').html(str); } btw, shouldn't make own attributes that, might con

F# sum of a list of lists -

i created own datatype , i'm trying create sum of numbers in datatype list of lists. don't want use f# libraries my datatype type elist = | l of int * elist i'm beginner in f# , trying grasp head on it. want recursively. thinking going traverse end of list , start sum , go front , add each one. example: let l = l(4, l(3, l(6, l(3, a)))) that should return val : int 16 here's code , know wrong: let rec sum l = let = 0 match l | -> 0 | l(head,a) -> head | l(head,tail) -> sum tail + you're there. need lose a : let rec sum l = match l | -> 0 | l(head,a) -> head | l(head,tail) -> head + sum tail then evaluating sum l when l = l(4, l(3, l(6, l(3, a)))) gives val : int = 16 as required.

java - Intellij -Project structure settings (spring facet config) - where are they stored? -

Image
have project migrating on netbeans intellij. intellij recognises spring config files , gives warning "please configure/setup spring facet modules". requires manually adding these under project structure settings. i don't want other team members have manually, wish check these settings git, according that, there no changed files in project directory (i have standard ignores added .gitignore). have tried searches of file contents config file names etc , turns nothing too. so question settings stored? in file typically on ignored list or in location external project directory? essentially idea related configuration project under .idea folder, example, project workspace iteams can find in .idea/worksapce.xml, include spring features mentioned. but not idea keep things in vcs, .idea folder ignore default in configuration items store local env related full path local gradle, e.g. <?xml version="1.0" encoding="utf-8"?> <project

osx - Best practice: Python development environment with docker for mac -

i work on mac , have python-flask application running inside container. using docker mac. purpose: want app reload automatically everytime make change in code. want access , make changes code ide(atom) in mac. my dockerfile creates virtualenv(/app/venv) when build image. workdir /app add ./myapp /app run virtualenv venv run venv/bin/activate && pip install requirements.lock when run container, mount code volume can access , make changes code local ide. volumes: - ./myapp:/app problem : problem approach venv folder got created in image build disappears because of volume mount made. what best practice around it?

Android c# App Login Best Practice -

i'm making android app in c#, , starts login page. anytime app closed, user has log in again. what's best practice auto-login, storing credentials somewhere , retrieving them? (if best way) thanks riccardo you can follow steps after successful login, save credentials in sqlite db or other database using. on logout, clear these credentials using deleteall<>() method. at startup/launch screen, first check if credentials present. if yes, show user next screen else display login screen. if don't wish delete credentials, use boolean flag in user object , mark accordingly. during password change, make sure replace old credentials new one, else user can login app using his/her old credentials.

wordpress - Validate and save address using AJAX in WooCommerce -

using wordpress 4.6.1 , woocommerce 2.6.4 i need create multi-step checkout woocommerce , customer first fill address, click on "next" validate , save address. before that, customer proceed next steps checkout. i did fine changes, customizing woocommerce templates, struggle "next" button action. how can create functionality of validate , save address form using ajax? want pretty "edit-address" endpoint functionality, using ajax. i check class-wc-ajax.php see how can save address form using ajax, there nothing me. close got process_checkout() function on class-wc-ajax.php , "final" checkout , need put more steps on checkout process. i don't want rewrite login of validating , saving this, since wc it. there @ least function of wc me validate , save easily? how can need? tips/help? thank guys!

excel - Convert date from 1st untill day of last month to 1'st date in month -

Image
i have lot of cell in excell table, how can convert date in month first date of month ? i have lot of data this +--------+---------------------+---------------------------------+-----------------+ | |items | date in | convert first of month | date_out | +-+------+---------------------+---------------------------------+-----------------+ |a|item 1| march 16, 2016 | march 01, 2016 | april 01, 2016 | |b|item 2| march 16, 2016 | march 01, 2016 | april 01, 2016 | |c|item 3| january 29, 2016 | january 01, 2016 | - | |d|item 4| january 29, 2016 | january 01, 2016 | - | +-+------+---------------------+---------------------------------+-----------------+ i need this, coz want calculate item have days on 2 months, so, if date_in 01 january, item have free time untill march 31. let say, item still not out until 20 april, date out = - want print like

python - softlayer api:How to buy the bandwidth package, changes and upgrades -

i developer, doing development work on softlayer api. have problem bandwidth package api interface. specific questions follows: 1. bandwidth package can replaced after purchasing finish? api ? 2. bandwidth package purchase , upgrade api? you need upgrade server here similar questions modify device configuration how add 2 or more disk softlayer virtual server while provisioning you need specify price new bandwidth want in request regards

iframe - Google Docs preview does not show S3 Signed URL -

i have embedded google docs preview in rails application. while using aws s3 signed url, not generate preview. how can solve problem? example <iframe src="http://docs.google.com/gview?embedded=true&amp;url=https://d2qvdh0r9424ok.cloudfront.net/mallow-tech/attachments/1/original/logo-page.png?1473416934&amp;expires=1473738491&amp;signature=csfjas6jg8pqdsmy3ytinv7a8ffyorupc~0d-cegw-hxwq96fv7vyuz3udmdmf7o2megefnvt2aiwpgcsqea8up~azecobuurakvr~fplrl-xrwofuizr7izsqqsr6mqedmlwoihbs3s9xisjy8j74l2po-u04om6dylsrf~ckpawgpf4uqgeupx1mj7my5ikiipfxjmu1mq-epvvwy3rrlpcfs~p9ybaqbxpsn4~p3vrx91qlcotfjfxwdolmbuiwnsqw8dnc6pfn1o9gsob0dyz6yu5im5-opdlxv8bv1nfaf8gmkhydzkn0w663irlkmmmwypquycmhd~oe2pvq__&amp;key-pair-id=apkajnwwfiaehghr4naq" style="width:600px; height:500px;" frameborder="0"></iframe> i think s3/cloudfront url not encoded. try encoded url. the url should https%3a%2f%2fd2qvdh0r9424ok.cloudfront.net%2fmallow-tech%2fattachm

aggregate - Sum up values according to time R -

i need sum values according timeline, here's data userid user_count time 215981 1702099122 1 2014-10-16 762721 2631243080 1 2014-11-17 806291 2753297247 1 2014-10-13 927621 3177288950 1 2014-11-22 136961 1632673193 1 2015-10-12 374601 1801088453 1 2015-11-9 if use aggregate add column called user_time user_time <- aggregate(user_count ~time, df, sum) then total user_count on each day, user_time 1. however, want compute sum each day. example, user_time on 2014-11-22 should 4, on 2014-10-16 should 2. wonder how properly. thank you. perhaps need cumsum library(dplyr) df %>% arrange(time) %>% mutate(count = cumsum(user_count)) or using base r transform(df[order(df$time),], count = cumsum(user_count))

ios - UICollectionViewCell can't set shadow -

Image
i want set shadow uicollectionviewcell , this: i write code in custom cell override func awakefromnib() { super.awakefromnib() layer.shadowcolor = uicolor(red: 0.7176470757, green: 0.7176470757, blue: 0.7176470757, alpha: 1.0000000000).cgcolor layer.shadowoffset = cgsizemake(0, 4) layer.shadowradius = 2 layer.shadowopacity = 1 } but can't set cell shadow. subview set shadow: how can solve problem? you should put clipstobounds.that problem. self.layer.shadowcolor = uicolor(red: 0.7176470757, green: 0.7176470757, blue: 0.7176470757, alpha: 1.0000000000).cgcolor self.layer.shadowoffset = cgsizemake(0, 4) self.layer.shadowopacity = 1.0 self.layer.shadowradius = 2.0 self.clipstobounds = false self.layer.maskstobounds = false

c# - Could not load file or assembly 'System.Runtime, Version=4.1.0.0' in .NET Core -

unhandled exception: system.io.filenotfoundexception: not load file or assembly 'system.runtime, version=4.1.0.0, culture=neutral, publickeytoken=b03f5f7f11d50a3a' or 1 of dependencies. system cannot find file specified. @ system.modulehandle.resolvetype(runtimemodule module, int32 typetoken, intptr* typeinstargs, int32 typeinstcount, intptr* methodinstargs, int32 methodinstcount, objecthandleonstack type) @ system.modulehandle.resolvetypehandleinternal(runtimemodule module, int32 typetoken, runtimetypehandle[] typeinstantiationcontext, runtimetypehandle[] methodinstantiationcontext) @ system.reflection.runtimemodule.resolvetype(int32 metadatatoken, type[] generictypearguments, type[] genericmethodarguments) @ system.reflection.customattribute.filtercustomattributerecord(customattributerecord carecord, metadataimport scope, assembly& lastaptcaokassembly, runtimemodule decoratedmodule, metadatatoken decoratedtoken, runtimetype attributefiltertype, boolean mu

machine learning - how to use Gower's Distance for KNN in weka? -

currently i'm working on knn classification , having both categorical , continuous variables in data set. decided use gower's distance similarity measure knn. gower's distance not available in weka knn classification. there way use gower's distance knn using weka? if possible, how can implement that? first should check how similar algorithms implemented in weka. suggest take @ how euclideandistance implemented. based on can create preferred algorithm. finally, have add new functionality in weka. achieve have check manual. more details check here , here

CSS to display the image wihout using img tag in HTML -

i'm new css. want place image before chapter title. have arrow image , want place image before chapter name, using css , without using html <img> tag. my code: .body > .ce_label:before{ background: url("arrow.png"); } <div id="body-proof" class="body top-most bottom-most"> <div id="opt_id_4224-proof" class="ce_label"> chapter<span class="tb"></span>11<span class="te"></span> </div> </div> i'm not getting correct output design. can me fix this? you can use below css this .ce_label:before{ content: url(arrow.png); }

ruby - Convert Hash Into And Array Of Strings -

{"offer:manage_all"=>["0", "1"], "offer:index"=>["0"], "offer:new"=>["0"], "offer:show"=>["0"], "offer:create"=>["0"], "offer:update"=>["0"], "offer:destroy"=>["0"], "job:manage_all"=>["0", "1"], "job:index"=>["0", "1"], "job:new"=>["0"], "job:create"=>["0"], "job:edit"=>["0"], "job:update"=>["0"], "job:destroy"=>["0"], "user:manage_all"=>["0", "1"], "user:index"=>["0"], "user:new"=>["0"], "user:create"=>["0"], "user:edit"=>["0"], "user:update"=>["0"], "user:destroy"=>["0&q

filesystems - Titanium - Android external storage - create new directory and then write files into it -

can not create new directory programmatically on external sd card (not internal memory of device) in android , can not write files on sd card? is titanium restricted write files on internal memory after using ti.filesystem.externalstoragedirectory ? can has ever been able create new directory programmatically on sd card in android write answer here or no 1 ever needs write on external sd card? you can use system class storage variables below to internal sd card can use string extstore = system.getenv("external_storage"); file f_exts = new file(extstore); to external sd card can use string secstore = system.getenv("secondary_storage"); file f_secs = new file(secstore); you can choose create folder , 1 use. edit environment.getexternalstoragedirectory() details return primary shared/external storage directory. this directory may not accessible if has been mounted user on computer, has been removed device, or other problem has happe

javascript - Unable to restrict redirection of page on File Upload in rails 5.0.0? -

i uploading file in chat application, on upload redirecting page. have tried in many ways restrict failed. please me valuable response. attachment model: class attachment < applicationrecord belongs_to :user belongs_to :chat validates_presence_of :user_id , :chat_id has_attached_file :attachment validates_attachment_content_type :attachment, content_type: /.*/ end attachment controller: class attachmentscontroller < applicationcontroller before_action :logged_in_user layout false def create @chat = chat.find(params[:chat_id]) @attachment = @chat.attachments.build(attachment_params) @attachment.user_id = current_user.id if @attachment.save actioncable.server.broadcast 'messages', message: @attachment.attachment, user: @attachment.user.name, action: "attachment" head :ok end end

How do I create custom routes in Ruby on Rails - 4.2 -

right have route below; resources :invoices collection match 'search' => 'invoices#search', via: [:get, :post], as: :search end end but 'deliveries#search' instead of 'invoices#search' . i customized below routes; get 'deliveries', to: 'invoices#index', as: :deliveries 'deliveries/new', to: 'invoices#new', as: :delivery 'deliveries/:id/edit', to: 'invoices#edit', :as => :del i have tried unable customized 'deliveries#search'. any suggestions welcome. thank in advance. resources :invoices, path: 'deliveries' collection match 'search' => 'invoices#search', via: [:get, :post], as: :search end end it generate route prefix deliveries /deliveries/your_action

How do you create reusable Animations in Angular 2 -

i'm playing animation api, , i'd create reusable animation sliding in content top level router views. managed through funky meta data syntax (which pretty cool once past crazy idea of using metadata) animations working. @component({ //moduleid: module.id, selector: 'album-display', templateurl: './albumdisplay.html', animations: [ trigger('slidein', [ state('*', style({ transform: 'translatex(100%)', })), state('in', style({ transform: 'translatex(0)', })), state('out', style({ transform: 'translatex(-100%)', })), transition('* => in', animate('600ms ease-in')), transition('in => out', animate('600ms ease-in')) ]) ] }) export class albumdisplay implements oninit { slideinstate = 'in'

Password regex not working fine -

i'm using function validatepassword(password) { var re = /^(?=.*[a-za-z])(?=.*[$@.$!%*#?&0-9])[a-za-z\d$@.$!%*#?&]{0,100}$/i; return re.test(password); } for password contains @ least 1 numbers or special character it's working fine atleast 1 character if no character returns false though give number or special character the /^(?=.*[a-za-z])(?=.*[$@.$!%*#?&0-9])[a-za-z\d$@.$!%*#?&]{8,15}$/i matches ^ - start of string (?=.*[a-za-z]) - requires @ least 1 ascii letter in line (?=.*[$@.$!%*#?&0-9]) - requires digit or special symbols. [a-za-z\d$@.$!%*#?&]{8,15} - 8 15 letters, digits , specified special symbols $ - end of string /i - case insensitive matching the (?=.*[a-za-z]) lookahead requires letter . if not need that, remove lookahead. use /^(?=.*[$@.!%*#?&0-9])[a-za-z\d@.$!%*#?&]{8,15}$/i or - if password must contain atleast 1 number , 1 special character : /^(?=[^0-9]*[0-9])(?=[^$@.!%*#?