Posts

Showing posts from April, 2013

git - How to fetch code (open status) from Gerrit? -

Image
right i'm using gerrit change id fetch specific change code gerrit's open status via command line. is there other way ? you can fetch code of proposed changes in gerrit using download dropdown on upper right side:

MySQL lag column DATEDIFF -

suppose have following data: customer_id contact_id comm_creation_day days_since_last_contact 10000 28036173295 2014-12-21 0 10000 28365672745 2015-01-29 datediff('2015-01-29','2014-12-21') 10000 28576719155 2015-02-26 datediff('2015-02-26','2014-01-29') 38409 28432217395 2015-02-07 0 38409 28565986955 2015-02-25 datediff('2015-02-25,'2015-02-07') i'm trying days_since_last_contact column, there's no lead or lag function in mysql. how do in single select statement? i tried following: select customer_id, comm_id , comm_creation_day, previous_comm_creation_day ( select c.* , @prev previous_comm_creation_day , @prev := comm_creation_day contacts c, (select @prev:=null) vars order customer_id, c.comm_creation_day, c.comm_id ) sq order customer_id, comm_creation_day but gave me: customer_id contact_id comm_creation_day last_contact_date 10000 2803...

Maximum count in SQL -

i have schema of players in league looks schema below. player (playerid integer, mentorid integer, leagueid integer, pay integer) league (leagueid integer, leaguename text) i trying find leagues have maximum number of players , solution should consider scenario having more 1 leagues have maximum number of players result should have - leaguename, count of players sorted leaguename.how that? with x ( select l.leaguename, count(distinct p.playerid) player_count player p join league l on p.leagueid = l.leagueid group l.leaguename) , y (select max(player_count) player_count x) select x.leaguename, y.player_count x join y on x.player_count = y.player_count order x.leaguename

c# - How to find draw on System.Windows.Controls.*? -

i'm digging in wpf application written in c#. need draw selection rectangle, 1 use select more 1 item (like files in folder). have few objects, of types system.windows.controls.control, system.windows.controls.contentcontrol , system.windows.frameworkelement. assume, need override event onpaint, ondraw or redraw/repaint. can use object draw rectangle , how? wpf , winforms different aspect. in winforms can override onpaint draw directly drawing context using graphics object in event handler. in wpf, there onrender method, seemingly behaves onpaint: protected override void onrender(drawingcontext dc) { solidcolorbrush mysolidcolorbrush = new solidcolorbrush(); mysolidcolorbrush.color = colors.limegreen; pen mypen = new pen(brushes.blue, 10); rect myrect = new rect(0, 0, 500, 500); dc.drawrectangle(mysolidcolorbrush, mypen, myrect); } however, in wpf every visual element object, cannot draw directly anything. "drawing" methods ...

php - CDb criteria conditions -

how make following sql condition in cdbcriteria $dbcommand = yii::app()->db->createcommand("select * offer_events enddate >= '$now' , title '%$locationdet%' , description '%$locationdet%' order id desc "); you try doing: $criteria = new cdbcriteria(); $criteria->condition = 'enddate >=:enddate , title :title , description :description'; $criteria->params = array( ':enddate'=>$enddate, ':title'=> '%' . $title . '%', ':description' => '%' . $description .'%' ); $criteria->order = 'id desc'; $model = somemodel::model()->find($criteria);

ruby - Middleman, where can I add custom methods, which modify output of the views -

i using middleman building api description web page, , wonder if possible define methods somewhere used parse yaml in desired format, looking place can put helper methods i put mine in config.rb inside helpers block, e.g. helpers def emphasise word word ? "<em>#{word}</em>" : word end def bracket word word ? "(#{word})" : word end end that helper in scope use in template. edit: found the section of docs defining custom helpers

javascript - get the content as well tags of the editable area from iframe editable -

i have created small editor have done few commands example font formatting and alignment etc working fine in browsers want export data written in editable area while tried fetch data inside editable iframe gives me error. error message: uncaught referenceerror: innerdoc not defined the following code written <html><head><title></title> <script> function iframeon() { richtextfield.document.designmode = 'on'; } function export_data() { var n = document.getelementbyid("richtextfield"); var innerdoc = n.contentdocument || n.contentwindow.document; var input = innerdoc.getelementsbytagname('body').text; var zip = new jszip(); zip.add("hello1.html", ""+input); zip.add("hello2.js", "this simple file"); content = zip.generate(); location.href="data:application/zip;base64," + content; </script> </head> <body> <i...

android - RetrofitError: Part body must not be null -

i having retrofit api call. , getting retrofit error of part body cannot null. please help. have checked domain. having 1 more 'get' working fine java code typedstring role = new typedstring("both"); int fbregisterflag = 0; typedstring firstname = new typedstring("saurabh"); typedstring lastname = new typedstring("lahoti"); typedstring password = new typedstring("saurabh"); typedstring email = new typedstring("saurabh@clicklabs.edu"); typedstring mobile = new typedstring("9650076366"); typedstring college = new typedstring("dtu"); typedstring biodescription = new typedstring("dtu"); typedstring[] transcripts = {new typedstring("saurabh"), new typedstring("lahoti")}; int year = 2011; typedstring[] majors = {new typedstring("saurabh")...

Hibernate 5 java.lang.NoSuchMethodError org.jboss.logging.Logger.debugf -

i have problem when deploy webapp hibernate 5 caused by: java.lang.nosuchmethoderror: org.jboss.logging.logger.debugf(ljava/lang/string;i)v @ org.hibernate.internal.namedqueryrepository.checknamedqueries(namedqueryrepository.java:149) [hibernate-core-5.0.0.cr2.jar:5.0.0.cr2] @ org.hibernate.internal.sessionfactoryimpl.checknamedqueries(sessionfactoryimpl.java:759) [hibernate-core-5.0.0.cr2.jar:5.0.0.cr2] @ org.hibernate.internal.sessionfactoryimpl.<init>(sessionfactoryimpl.java:490) [hibernate-core-5.0.0.cr2.jar:5.0.0.cr2] @ org.hibernate.boot.internal.sessionfactorybuilderimpl.build(sessionfactorybuilderimpl.java:444) [hibernate-core-5.0.0.cr2.jar:5.0.0.cr2] @ org.hibernate.cfg.configuration.buildsessionfactory(configuration.java:708) [hibernate-core-5.0.0.cr2.jar:5.0.0.cr2] @ org.hibernate.cfg.configuration.buildsessionfactory(configuration.java:724) [hibernate-core-5.0.0.cr2.jar:5.0.0.cr2] @ org.springframework.orm.hibernate4.localsessionfactorybuilder.buildsessionfactor...

seq - Assign times to 10 minute interval group in r -

i attempting "cut" data frame according times (by 10 min). dat <- read.table(text="time 4:30:08 3:37:00 pm 5:15:38 pm 5:16:41 pm 5:17:05 pm 5:17:25 pm 5:48:48 pm", header=true, sep="\t") i want this: time group 4:30:08 4:30 3:37:00 pm 3:30 5:15:38 pm 5:10 5:16:41 pm 5:10 5:17:05 pm 5:10 5:17:25 pm 5:10 5:48:48 pm 5:50 thanks! using edit input made question: > dat$group <- paste0(substr(dat$time,1,3), "0") > dat time group 1 4:30:08 4:30 2 3:37:00 pm 3:30 3 5:15:38 pm 5:10 4 5:16:41 pm 5:10 5 5:17:05 pm 5:10 6 5:17:25 pm 5:10 7 5:48:48 pm 5:40 admittedly don't know sure data looks thought unlikely poster had in actual r datetime or time class. @ least may provoke clarification.

php - how to get multiple values from multiple href -

hello using bootstrap , code dont work dont know whats different echo butmy code this <a class="btn btn-danger" href="update_appointment.php<?php echo '?f=' . $txn_id . 'id=' . $f . 'l=' . $l .'m=' . $m .'mn=' . $mn .'ptn=' . $ptn .'sn=' . $sn .'bi=' . $bi .'ui=' . $ui .'a=' . $a .'d=' . $d .'cn=' . $cn; ?>" ><i class="icon-check"></i>&nbsp;yes</a> if enter button echo, button doesnt show? please me

excel - Error in copying range using inputboxes from one sheet to anoyher -

Image
i have been trying copy defined range through input-box defined range through input-box on other sheet. getting error run-time error "'1004' application define or object defined error". on line rngcopyfrom.copy thisworkbook.sheets("sheet2").range("rngcopyto") my level beginner. please guide me in way change serve desired objective. sub sample() dim rngcopyfrom range dim rngcopyto range on error resume next set rngcopyfrom = application.inputbox("enter range ant copy", type:=8) on error goto 0 on error resume next set rngcopyto = application.inputbox("enter range want copy", type:=8) on error goto 0 if not rngcopyfrom nothing '~~> copy range shhet2 rngcopyfrom.copy thisworkbook.sheets("sheet2").range("rngcopyto") end if end sub this program works if define fixed range shown in line below. rngcopyfrom.copy thisworkbook.sheets(...

C code to reverse a string - including NULL character at the end of string -

1.) possible reverse string including null character (which means “abcd” represented 5 characters, including null character.) 2.) in current implementation, doesn't take 1.) account, getting segmentation error during swapping. ie while assigning: *str = *end; void reverse(char *str) { char * end = str; char tmp; if (str) { // handle null string while (*end) { // find end character ++end; } --end; // last meaningful element while (str < end) // terminal condition: str , end meets in middle { tmp = *str; // normal swap subroutine *str = *end; // str advance 1 step *end = tmp; // end 1 step str++; end-- ; } } return; } your function correct. seems problem trying reverse string literal. may not change string literals. immutable. attemp change ...

android - How can I create same sized tabs in TabLayout -

i using designsupportlibrary (v22.2.0) , want tabs in tablayout same width - regardless tab text length. have tried mode_fixed still shows tabs different widths. here xml: <android.support.design.widget.tablayout android:id="@+id/tab_layout" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="?attr/colorprimary" android:theme="@style/themeoverlay.appcompat.dark.actionbar" app:tabmode="fixed"/> if want specify minimum width each tab, can set in style: <style name="mytablayoutstyle" parent="themeoverlay.appcompat.dark.actionbar"> <item name="tabminwidth">100dp</item> </style> and set theme style instead (you can delete tabmode attribute well): <android.support.design.widget.tablayout android:id="@+id/tab_layout" android:layout_width="wrap_content" andro...

xml - android.support.v7.widget.Toolbar not found (Android Studio) -

for round 2 weeks now, receive error message, whenever try preview .xml design-file in android studio project. relatively new whole topic i'd ask whether have answer. the error message: rendering problems: following classes not found: - android.support.v7.widget.toolbar or rendering problems: following classes not found: - android.support.v7.widget.cardview one of .xml files: <?xml version="1.0" encoding="utf-8"?> <android.support.v7.widget.toolbar xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/toolbar_tabs" android:background="@color/primarycolor" app:contentinsetstart="0dp" app:contentinsetend="0dp"> <relativelayout ...

java - How to create a standalone library in Android using AndroidStudio? -

i new java/ android world. come c background. androidstudio / gradle stuff bit overwhelming me. i looking create library using androidstudio. when click on "start new android studio project" asks me application name , activity et al. gets confusing me. why these details required create library module? missing here? i know there file - > new module menu , stuff, comes later once have set applicaton details. here, dont want create application, lib (similar shared library create in c using makefiles/autotools). also, library in android world jar file (like have *.so in c), right? 1) while android tools accept/use java jar files, jars don't contain android specific stuff resources (bitmaps,xml) necessary meta-data merge of client project. 'new' gradle based tools have aar format http://tools.android.com/tech-docs/new-build-system/aar-format , toolchain knows how handle them. 2) brings create aar file in android studio

javascript - Parsing plain text Markdown from a ContentEditable div -

i know there other questions on editable divs, couldn't find 1 specific markdown-related issue have. user typing inside contenteditable div. , may choose number of markdown-related things code blocks, headers, , whatever. i having issues extracting source , storing database displayed again later standard markdown parser. have tried 2 ways: $('.content').text() in method, problem line breaks stripped out , of course not okay. $('.content').html() in method, can line breaks working fine using regex replace <br\> \n before inserting database. browser wraps things ## heading here divs, this: <div>## heading here</div> . problematic me because when go display afterwards, don't proper markdown formatting. what's best (most simple , reliable) way solve problem of 2015? edit: found potential solution here: http://www.davidtong.me/innerhtml-innertext-textcontent-html-and-text/ if check documentation of jquery...

ios - PrepareForSegue is not being called when I did select a tableViewCell in SplitViewController's Master View -

i using tableviewcontroller master view of splitviewcontroller . looks right don't understand why prepareforsegue() not being called when click on row? can force calling performseguewithidentifier() on tableview.didselectrowatindexpath . guess should not need while using splitviewcontroller . 1 more thing, did not change in appdelegate . could reason tableviewcontroller not being recognized masterview of splitviewcontroller? here how tableviewcontroller looks like: class masterviewcontroller: uitableviewcontroller { var links = [sidebarlink]() override func viewdidload() { super.viewdidload() self.links.append(sidebarlink(label: "home", url: "http://google.com")) self.links.append(sidebarlink(label: "contact", url: "http://google.com")) } override func didreceivememorywarning() { super.didreceivememorywarning() } // mark: - table view data source override func...

onsen ui - How to use lazy repeat to display more than one item per line? -

instead of displying items 1 above 1 in basis example item#1 item#2 item#3 what can arrange items in 2 or 3 columns per row below ? item#1 item#2 item#3 item#4 item#5 item#6 item#7 item#8 item#9 you can puttin ons-list inside ons-carousel , here example: <ons-page> <ons-carousel swipeable overscrollable auto-scroll style="height: 100%; width: 100%;"> <ons-carousel-item ng-repeat="i in [0,1]"> <ons-list> <ons-list-item ng-repeat="j in [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20]"> item #{{ j + * 21 }} </ons-list-item> </ons-list> </ons-carousel-item> </ons-carousel-item> </ons-page>

Error occured while trying to connect with bluetooth module HC-05 connected with arduino in android program -

i trying exchange data in between arduino , android phone via bluetooth module hc-05 , anenter image description hered 3-4 days unable identify cased of following error: ([jsr82] connect: connection not created (failed or aborted).) occurred while try connect paired bluetooth module using mac address. i post mainactivity.java , activity_main.xml files , arduino code too. main activity java file :- package bluetooth.majorproject.bt; import android.app.activity; import android.bluetooth.bluetoothadapter; import android.bluetooth.bluetoothdevice; import android.content.broadcastreceiver; import android.content.context; import android.content.intent; import android.content.intentfilter; import android.support.v7.app.actionbaractivity; import android.os.bundle; import android.util.log; import android.view.menu; import android.view.menuitem; import android.widget.arrayadapter; import android.widget.button; import android.widget.listview; import android.widget.toast; import ...

sharepoint - Javascript - Need to Work With Elements With Generic Classes -

i have javascript written accommodate needs conditional formatting on sharepoint page. there few tables, in web parts, in making changes style of of cells. used nodelist accomplish needs (no unique ids), , working alright, until changes made table threw nodelist references off (i knew inevitable..). wondering if has input on how better select or distinguish between elements have same class name , contain data change. example: <td class="asd"> blah blah blah </td> <td class="asd"> content content </td> <td class="asd"> test test test </td> select them using getelementsbyclassname() var tds = document.getelementsbyclassname('asd'); console.log(tds); (var = 0; < tds.length; i++) { tds[i].style.color = 'green'; } <table> <tr> <td class="asd">blah blah blah</td> <td class="asd">content content</td> <t...

r - How to suppress message of package leaflet? -

i using 'leaflet' package r-studio plot geo-data. creating rmarkdown file same. everything works fine. following message in beginning in rmarkdown output file: assuming 'lng' , 'lat' longitude , latitude, respectively i have tried best suppress message, no success far. it's not harmful irritating!!! the code: `{r, echo=false, warning=false} options(warn=-1) long = runif(40, -87, -80) lat = runif(40, 25, 42) m = leaflet() %>% addtiles() df = data.frame( lng=long, lat=lat,size = runif(40, 5, 20), color = sample(colors(), 40)) m = leaflet(df) %>% addtiles() m %>% addcirclemarkers(radius = runif(40, 4, 10), color = c('red','blue','green'))` you want message option in chunk header, e.g. ```{r, echo=false, warning=false, message=false}

android - How can I send a simple text to php file using the openConnection () method -

when search sending simple text android php file find examples use deprecated classes , packages such org.apache.http , etc. , google recommends use openconnection() method in url class. but when search url class , urlconnection class , httpurlconnection class, can not find methods send simple text php file. please aware me. well, create class this: httpurlconnectionhandler.java import java.io.bufferedreader; import java.io.dataoutputstream; import java.io.inputstream; import java.io.inputstreamreader; import java.net.httpurlconnection; import java.net.url; public class httpurlconnectionhandler { protected string urlg = "http://192.168.43.98/yourdirectory/"; public string sendtext(string text) { try { url url = new url(urlg+"receivedata.php"); httpurlconnection conn = (httpurlconnection) url.openconnection(); conn.setrequestmethod("post"); // para activar el metodo post co...

python - Flask post url is not redirecting dynamic link -

i having problems on getting tutorial flask on displaying dynamic link on blog post. dynamic link suppose http://localhost:8000/blog/hello but got gibberish link instead http://localhost:8000/%3cbound%20method%20post.url%20of%20%3c__main__.post%20object%20at%200x7f04ddd9dd50%3e%3e import os import sys import collections flask import flask, render_template, url_for, abort, request flask.ext.frozen import freezer werkzeug import cached_property werkzeug.contrib.atom import atomfeed import markdown import yaml string import strip posts_file_extension = '.md' class sorteddict(collections.mutablemapping): def __init__(self, items= none, key=none, reverse=false): self._items = {} #python dict self._keys =[] #python list if key: self._key_fn = lambda k: key(self._items[k]) else: self._key_fn = lambda k: self._items[k] self._reverse = reverse if items not none: self.update(items)...

Custom Formated Class.cs File - Visual Studio -

Image
now structure c# class files in regions: ** property region field region constructor region method region ** is there anyway create custom class template includes regions (and formatting) automatically when press add new item -> class... can save time? i'm using visual studio 2013 ultimate. you edit visual studio c# class template: using system; using system.collections.generic; $if$ ($targetframeworkversion$ >= 3.5)using system.linq; $endif$ using system.text; $if$ ($targetframeworkversion$ >= 4.5)using system.threading.tasks; $endif$ namespace $rootnamespace$ { public class $safeitemrootname$ { #region properties #endregion properties #region fields #endregion fields #region constructors #endregion constructors #region methods #endregion methods } } you can see location of them in this answer.

php - Laravel kick user via session -

i want able kick logged in users via sessions... so want delete session in database (structure below) , "kick" user te logged in users. how can session of users , merge them users? so session id d98af07db237867a62e8ee53b372847f89363eae belongs user robin . but session id dsdfjsmoijqsfqsfsqf5qs54fq5f4s6f4s6d54f belongs user patrick . my database looks standard of laravel id, payload , last_activity. hope can me out.

plsql - PLS-00103 error when creating object type -

i trying create , assign variables using following code create object types in plsql (11g) facing errors: begin execute immediate 'drop type picu_obj force'; execute immediate 'drop type picu_obj_tab force'; execute immediate 'create type picu_obj object(customer_id varchar2(32767),customer_name varchar2(32767),server_name varchar2(32767),time_stamp varchar2(32767))'; execute immediate 'create type picu_obj_tab table of picu_obj;'; picu_var picu_obj_tab; picu_var := picu_obj_tab(picu_obj('101','xyz','pro-ssr-qr','12:13')); end; above code gives following errors: error @ line 6: ora-06550: line 6, column 10: pls-00103: encountered symbol "picu_obj_tab" when expecting 1 of following: := . ( @ % ; symbol ":=" substituted "picu_obj_tab" continue. please suggest doing wrong here. there 2 problems code: first: in oracle 11g can not use varchar2(32767) maximum length 4000 var...

javascript - Defining array of values in Collection in Meteor -

i have defined following collection in application: projects = new mongo.collection("projects") in collection, have inserted: projects.insert({ source: "https://upload.wikimedia.org/wikipedia/commons/7/7f/pug_portrait.jpg", title: "pug", artist: "pug", description: "this piece shows duality of pug", price: "priceless" }); projects.insert({ source: "http://i.stack.imgur.com/d2abd.gif", title: "doge", artist: "doge", description: "much doge, many deal it, wow", price: "bout tree fiddy" }) i attempting create array of sources of images using following helper function: sourcearray : function () { // returns array of sources var sources = []; (var = 0; < projects.find().count(); i++) { sources.push(images[i].source); } return sources; } the "images va...

hibernate - How to reduce flush when using native queries in spring-data-japa? -

i working on project using spring 4.2 , hibernate 4.3. by profiling, found repository methods @org.springframework.data.jpa.repository.query(nativequery=true) takes time. because org.hibernate.pa.internal.queryimpl.getresultlist() calls javax.persistence.entitymanager.flush() internally, regardless flush-mode use. flush() takes time if lot of entity in persistence context. i think can avoided calling org.hibernate.sqlquery.addsynchronizedentityclass() , don't know best way call addsynchronizedentityclass() using spring-data-jpa (or other way tell hibernate not flush.) what best practice reduce flush? you can set flush mode commit desired (or all) sessions. keep in mind manually flush session if query depends on dirty session state.

Histogram of one field wrt another in pandas python -

Image
i trying plot histogram distribution of 1 column respect another. example, if dataframe columns ['count','age'], want plot total counts in each age group. suppose in age: 0-10 -> total count 20 age: 10-20 -> total count 10 age: 20-30 -> ... etc i tried groupby('age') , plotting histogram didn't work. thanks. update here of data df.head() age count 0 65 2417.86 1 65 4173.50 2 65 3549.16 3 65 509.07 4 65 0.00 also, df.plot( x='age', y='count', kind='hist') shows ok,if understand correctly, want weighted histogram import pylab plt import pandas pd np = pd.np df = pd.dataframe( {'age':np.random.normal( 50,10,300).astype(int), 'counts':1000*np.random.random(300)} ) # test data #df.head() # age counts #0 38 797.174450 #1 36 402.171434 #2 49 894.218420 #3 66 841.786623 #4 51 597.040259 df.hist('a...

java - Using Jersey to get a CSRF token through REST and use it in a login -

using jersey 2.19, how csrf token server uses spring security 3 , make successful login? have 2 projects, client uses rest, , server created using jhipster. first, i'm making request http://localhost:8080 , i'm getting response headers: cache-control:no-cache, no-store, max-age=0, must-revalidate content-language:en content-length:17229 content-type:text/html;charset=utf-8 date:tue, 21 jul 2015 19:24:40 gmt expires:0 last-modified:thu, 02 jul 2015 17:07:31 gmt pragma:no-cache server:apache-coyote/1.1 set-cookie:csrf-token=0902449b-bac7-43e8-bf24-9ec2c1faa48b; path=/ x-application-context:application:dev:8081 x-content-type-options:nosniff x-xss-protection:1; mode=block i extract set-cookie header , csrf token there. i'm making post request way: http://localhost:8080/api/authentication?j_username=user&j_password=user&submit=login with request headers: content-type: application/x-www-form-urlencoded x-csrf-token: <extracted token> using chrome...

javascript - How to swap an image with another when hovering on the other image? -

i have 5 small images , 1 image twice size small ones. i'm trying whenever hover on small images big image changes image hovering. having hard time searching methods , functions luck of yet. have <div class="bigimg"> <img id="image0" src="images/image1.png"> </div> <img id="image1" src="images/image1.png"> <img id="image2" src="images/image2.png"> <img id="image3" src="images/image3.png"> <img id="image4" src="images/image4.png"> <img id="image5" src="images/image5.png"> i trying add function saw somewhere else here function mouseover() { document.getelementbyid("image0").innerhtml = '<"image2.png"/>'; } function mouseout() { document.getelementbyid("image0").innerhtml = '<img src="image1.png" />'; } i wrote img ta...

c++ - No Video Played in DirectShow MSDN Example -

i'm trying go through directshow documentation provided on msdn. i'm relative beginner c++, well. on first example code in directshow documentation here: https://msdn.microsoft.com/en-us/library/windows/desktop/dd389098(v=vs.85).aspx followed along, modified file string point video on own computer, included , added strmiids.lib library reference. code builds successfully, , console window appears. that's it. no video renders. i'm using vs2015, on windows 8.1 laptop, , have windows sdk installed well. that's got strmiids.lib file. awesome, has been frustrating obstacle in way of learning directshow programming. thanks!

javascript - How to get text within div to be relative to the div's width and height, CSS, HTML -

i'm trying text within div relative size of div, when zoom in text gets bigger along div, , when zoom out text gets smaller along div. example, if hit ctr , - @ same time on stackoverflow, , zoom out 25%, can see text shrinks along div, way 25%, oppose text shrinking or div shrinking - shrink @ same time. i'm trying of effect. thanks. div { width: 50%; height: 50%; font-size: 12%; } <div> text </div> try em based font-size show below relative. please check working example here . body { font-size: 16px; /* declare base font-size. */ } div { width: 50%; height: 50%; font-size: 1em; }

node.js - Sending parameters with file - Delivery.js and socket.io -

i'm trying upload file using nodejs,socket.io , delivery.js. file upload working fine me, need send parameters file.but don't see how can that! here's code far. client.html var socket = io.connect(); var delivery = new delivery(socket); function sendfile(){ delivery.on('delivery.connect',function(delivery){ var file = document.getelementbyid("file").files[0]; var extraparams = {foo: 'bar'}; delivery.send(file, extraparams); //trying send params file return false; }); delivery.on('send.success',function(fileuid){ alert("file sent."); }); } and server.js io.sockets.on('connection', function(socket){ var delivery = dl.listen(socket); delivery.on('receive.success',function(file){ // delivery.on('receive.success',function(file,params){<--tried var params = file.params; console.log(params); fs.writefile(file.name,f...

ios - How to hide Navigation and Status Bars when tapped - with animation -

i'm trying hide status bar , navigation bar when view tapped. found works previous question, problem there no animation when hiding bars. disappears. here current code in view controller: override func viewdidload() { super.viewdidload() self.navigationcontroller?.hidesbarsontap = true } override func prefersstatusbarhidden() -> bool { if self.navigationcontroller?.navigationbarhidden == true { return true } else { return false } } when tap again, animation works when 2 bars coming on screen. if don't include overrided prefersstatusbarhidden function, can navigation bar hide desired sliding animation. status bar still there. any suggestions? swift 2 have new method can work? try var statusbarhidden = false func tapaction() { self.navigationcontroller?.navigationbarhidden = true self.statusbarhidden = true self.setneedsstatusbarappearanceupdate() } override func pr...

Facebook likes disappears from my blog posts -

i have blog publicate posts weekly, or whatever. point added opengraph meta elements html code: <meta property="og:image" content="http://..." /> <meta property="og:title" content="..."> <meta property="og:description" content="..."> <meta property="og:url" content="http://..."> when changed code disappears facebook likes posts. thats of modifications. think isn't big thing. is there reason why disappers likes?

c++ - How to access a vector array? -

std::vector<int> example[1024]; how can access 1024 "examples" , vector elements? when try example[0] same example.at(0) , access the first element in vector... i want same variables: int variable[1024]; ... instead of integer there vector... it not clear want accomplish, std::vector works pretty classic c++ array. and elements go 1 after in memory, can example std::vector<int> test(1024); test[0] = 1; test[1] = 4; test[2] = 8; int* first = &test[0]; std::cout << "first " << *first << std::endl; int* second = first + 1; std::cout << "second " << *second << std::endl;

javascript - How to uncheck check-box by clicking on item that was dynamically added with that checkbox -

i stuck problem.. general idea have check-boxes, , clicking on them, value remove button appended on div. problem can't uncheck specific check-box clicking on appended item. here function's use appending , removing elements. function appendchoices() { len = userchoices.length; // if len === 0 no need check if(!len) return false; for(i = 0; < len; i++){ option = userchoices[i]; $categorydiv = $('#' + option.category + '-container'); $categorydiv.append('<span class="filteritemappended" data-item="'+option.value+'">' + '<a href="#" onclick="removerecord('+ +')"><span class="glyphicon glyphicon-minus"></span></a>' + option.value +'</span>'); // need if reset button used $('#checkbox-list...

javascript - Switching views does not switch controller in angular -

i have simple angular app uses 2 templates , controllers. 2 buttons placed switch views.they call function, defined within controlles, uses window.location='' switch location. however, if place ng-controller directive, template changes controller not. if remove ng-controller directive, no controller loads @ all,but default view rendered. what going wrong?? here code: html: <body ng-app='schoolconnect' ng-controller='takectrl' > <div ng-show='loading' style='margin-top:100px' > <!--content--> </div> <table width=40% align='center' style='margin-bottom:10px' > <tr> <td align='center' > <!-- buttons switch view --> <div class='btn-group' > <button class='btn btn-lg' ng-class='take_btn' ng-disabled='istaking' ng-click='takeattend()' > &nbsp;take&nbsp; </button> <button class...

html - Show label and sliding checkbox on same line -

in html page, trying align label , sliding checkbox on same line. code given below (the sliding checkbox code taken post here). .ondisplay { display: inline-block; } /* slide 3 */ .slidethree { width: 80px; height: 26px; background: #333; margin: 10px auto; -webkit-border-radius: 50px; -moz-border-radius: 50px; border-radius: 50px; position: relative; -webkit-box-shadow: inset 0px 1px 1px rgba(0, 0, 0, 0.5), 0px 1px 0px rgba(255, 255, 255, 0.2); -moz-box-shadow: inset 0px 1px 1px rgba(0, 0, 0, 0.5), 0px 1px 0px rgba(255, 255, 255, 0.2); box-shadow: inset 0px 1px 1px rgba(0, 0, 0, 0.5), 0px 1px 0px rgba(255, 255, 255, 0.2); } .slidethree:after { content: 'off'; font: 12px/26px arial, sans-serif; color: #000; position: absolute; right: 10px; z-index: 0; font-weight: bold; text-shadow: 1px 1px 0px rgba(255, 255, 255, .15); } .slidethree:before { content: 'on'; font: 12px/26px arial, sans-s...

phpredis - If I run a long transaction or Lua script on a master redis instance, does it block on the read-only slaves -

i want able access recent copy of master redis server keys. doesn't have date polling read copy don't want transactions , lua scripts run on master instance block on read instance scan through keys on read instance. can confirm/deny behaviour? it won't block slaves anything, while master busy processing logic replication stopped. once logic ends (possibly generating writes), replication resume previous buffered contents , new ones (if any).

c# - Create Table with Parameters -

create excel table, using oledb : oledbcommand oledbcommand = new oledbcommand(); oledbcommand.connection = oledbconnection; string commandtext = "create table" + " [" + sheetmodel.sheet.name + "] "; commandtext += "("; (int index = 0; index < spalten; index++) { string _header = sheetmodel.dt1.rows[heaader].itemarray[index].tostring(); oledbcommand.parameters.add(new oledbparameter("@var" + (index + 1).tostring(), _header)); if (index > 0) { commandtext += ", "; } commandtext += "@var" + index.tostring() + " varchar"; } commandtext += ");"; try { oledbcommand.commandtext = commandtext; oledbcommand.executenonquery(); oledbcommand.parameters.clear(); } catch (exception exception) { messagebox.show(exception.message); return; } the result excel table is, @var0 @var1 @var2 @var3 @var4 @var5 but should this: ...

Programming C# Windows form IF else statement on ComboBox -

given: 4 combo box named cbotype, cbofloor, cboroom, cborate . here condition. if choose bedspace in cbotype, cbofloor appear "1", cboroom appear list of rooms in floor 1, cborate appear "1000". cbofloor.items.add("1"); cboroom.items.add("floor 1"); cborate.items.add("1000"); this answer?

ios - Parse & Swift- Randomizing images -

first, simple, how change blank uiimage view image have stored in parse? code far var query = pfquery(classname:"content") query.getobjectinbackgroundwithid("mlwvjlh7pa") { (post: pfobject?, error: nserror?) -> void in if error == nil && post != nil { //content.image = uiimage } else { println(error) } } on top of replacing blank uiimageview, how may make image replaced random? assume can't use objectid anymore, because specific row represents. i first retreive objectids parse getobjectsinbackgroundwithblock, , select random objectid array in variable called objectid. way save user querying every object parse , using lot of data doing it. second getobjectinbackgroundwithid(objectid) if error == nil { if let image: pffile = objectrow["image"] as? pffile{ image.getdatainbackgroundwithblock { (imagedata: nsobject?, error: nserro...

Android Java more than 1 return statement -

this question has answer here: how return multiple values? [duplicate] 4 answers i got inside method view android = inflater.inflate(r.layout.asd_frag, container, false); ((textview) android.findviewbyid(r.id.textviewasd01)).settext("asd"); return android; view android02 = inflater.inflate(r.layout.asd02_frag, container, false); ((textview) android.findviewbyid(r.id.textviewasd02)).settext("asd02"); return android02; so problem cannot return 2 return statements inside method, know trick make happen. create custom object contain 2 values or use pair.create(a, b)

colors - c# colorpicker and loading -

i have got colorpicker save user selection text file, , color gets loaded @ program startup. problem using .toknowncolor(); fine, there colours in colorpicker swatch doesn't - fine black/white/yellow/red/blue/etc - basic colours, when starts going different shades of colour, doesn't it. assuming because not known color. have tried other 2 options (toargb() + tostring()) can't them work. here have; //in linklabel private void textcol_linkclicked(object sender, linklabellinkclickedeventargs e) { colordialog textcolour = new colordialog(); textcolour.allowfullopen = false; textcolour.showhelp = true; if (textcolour.showdialog() == dialogresult.ok) { #region labels label1.forecolor = textcolour.color; if (customise == true) { file.writealltext("c:/bmw/colours/textcol.txt", textcolour.color.toknowncolor() + "...

html - Bootstrap navbar not collapsing on iPhone -

i creating site using bootstrap, working fine when go view site on iphone navbar doesn't collapse. when viewing on windows phone works perfectly. here code header, can see why happening? <!doctype html> <html <?php language_attributes(); ?>> <head> <title><?php wp_title( ' | ', true, 'right' ); ?></title> <link rel="stylesheet" type="text/css" href="<?php echo get_stylesheet_uri(); ?>" /> <script src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <link href='http://fonts.googleapis.com/css?family=lato' rel='stylesheet' type='text/css'> <meta name="viewport" content="initial-scale = 1.0,maximum-scale = 1.0" /> <?php wp_head(); ?> </head> <body <?php body_class(); ?>> <!-- top logo , search bar --> <div class=...