Posts

Showing posts from September, 2011

Android API 19 support AlertDialog black border instead of shadow -

Image
android 5.1 renders dialog correctly, kitkat 4.4.4 , below show black border instead of shadow. it seems android:windowbackground responsible that. have tried different drawables background, tried genymotion , android sdk emulators , tried older support libraries without success. did not set styles dialog. shown fragment . the error see in logcat - eglsurfaceattrib not implemented the border, round corners , margin defined android:windowbackground. try add below line java file: dialog.getwindow().setbackgrounddrawableresource(android.r.color.transparent);

ios - Getting all decimals from interger being Squarooted -

the solution of square root of 11 in normal calculator 3.31662479036 i trying round 3.32 so problem having in ios is; in viewdidload int mynumber = sqrt(11); nslog(@"%d", mynumber); i keep getting 3 when should first 3 integers. can me solve this? int integers, not decimals. use float , %f . float mynumber = sqrtf(11); nslog(@"%.2f", mynumber);

xpages - Is this a bug in the Tab Container? -

i think bug in tab container... opening new tab using java or server side javascript createtab method when new tab contains panel set iframe pointing xpage in same database cause xpage reloaded after loading 5 or 6 tabs (in chrome, ie same takes more tabs...) if tab contains iframe points database holds xpage works fine. the ssjs code is: getcomponent("djtabcontainer1").createtab({title:"new tab"}); ; the java code public static boolean createtab(uidojotabcontainer tabcontainer) { try { if (tabcontainer == null) { tabcontainer = (uidojotabcontainer) utils.findcomponent("tabcontainer"); if (tabcontainer == null) { return false; } } string tabtitle = null; string url = null; string unid = null; uidojotabpane newtab = null; // default number current project preferences tabtitle = "my tabpage"; url = utils.g

angularjs - Angular in Rails throws an error in production `Error: [$injector:unpr] Unknown provider: e` -

when running app in development works fine. when deployed, throws error : error: [$injector:unpr] unknown provider: e the url app : http://shimizu.leafycode.com/panel/signin the js files : https://gist.github.com/thpubs/3a9e088ad3410e18030c i followed other stack-overflow answers , fixed app accordingly still problem there! please help. your code being minified , can see @ least 1 place in app.js not using array notation when calling .config , .run so in app.js update line .config(function($mdthemingprovider) { to .config(['$mdthemingprovider', function($mdthemingprovider) { // ... code ... }]) and line .run(function($rootscope, $templatecache) { to .run(['$rootscope', '$templatecache', function($rootscope, $templatecache) { // .. code ... }]) double check other places in code injecting services.

java - Null pointer exception in passing checkbox value -

i made index page in take value of checkbox , pass on file named addtowork.java showing null pointer exception. there problem in passing value of checkbox. kindly help. here code snipped index page <td> <center> <form action="addtowork?id2=<%=mail.gettemptoken()%>" method="post"> <input type="submit" value="add work"> <input type="checkbox" name="flag" value="flag">high priority</form> </center></td> for addtowork.java protected void dopost(httpservletrequest request, httpservletresponse response) throws servletexception, ioexception { emaildesc mail = new emaildesc(); string imp = new string(); imp = (string) request.getparameter("flag"); string thisid = request.getparameter("id2"); home home = new home(); user user = new user(); user = (user) request.getsession().getattribute("user&quo

c# - How can I iterate through a multi lined textbox and asynchronously run LINQ SQL queries for each line? -

basically, want do. imagine textbox with: computer1 computer2 computer3 i want put these multi-lined textbox on asp .net page, , have iterate through these objects , run linq-sql query on each one. basically, linq-sql query return pc's software installed (this might end in excel spreadsheet can work once have data back). my challenge this: want run query asynchronously, , update user after each computer has had linq-sql query run against (something checking computer2... checking computer 3...). query pretty complex, , @ end has "add up" machines data , put datatable exporting. the main thing has got me stumped async linq sql, , how update user computer "currently" on. any awesome :) executing each of sql query lines, expecting results stream finish execution. classic http communication not sutied type of process (although possible of course). i go way: - create signalr server - post sql line server , "job id" - on clien

How to add attributes ColdFusion tags in bulk -

i curious if there way force coldfusion tag hold attribute default, such datasource in cfquery. for example instead of writing <cfquery datasource="mydatasource"> i can write <cfquery> and system automatically knows datasource "mydatasource". would cool if possible. it possible datasource, not everything. you may set this.datasource="mydatasource" default datasource in application.cfc https://wikidocs.adobe.com/wiki/display/coldfusionen/application+variables

Microsoft Excel VBA text split tweak -

Image
i have excel sheet uses macro split string of text when scanned (via plug&play barcode scanner) first column right using space character delimiter. example picture of excel sheet followed excel macro. sub textsplit(rng range) dim c range, arr each c in rng.cells if len(c.value) > 0 arr = split(c.value, " ") c.offset(0, 1).resize(1, ubound(arr) + 1).value = arr end if next c end sub now of works perfectly, need make little tweak this. i macro skip column after first serial ("cna1234567") , leave blank . how can tweak code this? this method little more explicit , give control want. sub textsplit(rng range) dim c range dim r long dim arr variant each c in rng.cells if len(c.value) > 0 r = c.row arr = split(c.value, " ") sheet1 .cells(r, 2).value = arr(0) '.cells(r, 3).value = <

c# - How do I detect all TransformManyBlocks have completed -

i have transformmanyblock creates many "actors". flow through several transformblocks of processing. once of actors have completed of steps need process whole again. the final var copyfiles = new transformblock<actor, actor>(async actor => { //copy fo files , wait until done await actor.copyfiles(); //pass me along next process return actor; }, new executiondataflowblockoptions() { maxdegreeofparallelism = -1 }); how detect when of actors have been processed? completions seems propagated , tell there no more items process. doesn't tell me when last actor finished processing. completion in tpl dataflow done calling complete returns , signals completion. makes block refuse further messages continues processing items contain. when block completes processing items completes completion task. can await task notified when block's work has been done. when link blocks (with propogatecompletion turned on) need call comp

android - SharedPreferences - CastException: HashSet cannot be cast to TreeSet -

i trying store treeset in sharedpreferences using following code: set<string> chemicalvaluesset = new treeset<>(); chemicalvaluesset.add("id: " + checkfornull(jsonchemicalvalues.getstring("id"))); editor.putstringset(sp_chemical_values, chemicalvaluesset); editor.apply(); however, when try access treeset getting casting error, if set declared hashset . sharedpreferences sharedpreferences = getsharedpreferences(shared_preferences, context.mode_private); treeset<string> chemicalvalues = (treeset<string>) sharedpreferences.getstringset(sp_chemical_values, null); i have no clue solving issue. in addition, when started writing part setting chemicalvaluesset hashset , retrieving without problems, afterwards decided go treeset s. that's why have tried cleaning , restarting project, still same issues persists. however, if change type hashset in part retrieve set,

datetime - IOS date to string gives me wrong date -

i working time stamp shows following server:2015-07-23t17:08:00z. however, have tried multiple ways extract month , keeps returning "january". when turn date stamp string, following:2015-01-23 17:08:00 +0000. know why month keeps getting reverted jan? year day , time fine... appreciated. this code works me: nsstring *dateasstring = @"2015-07-23t17:08:00z"; nsdateformatter *dateformatter = [nsdateformatter new]; dateformatter.dateformat = @"yyyy-mm-dd't'hh:mm:ssz"; nsdate *date = [dateformatter datefromstring:dateasstring]; nslog(@"%@", date); my guess have wrong symbol month in nsdateformatter .

excel - Find minimum value in range after a maximum value -

i have data structured follows: a1:a8 (10, 2, 11, 15, 17, 10, 4, 5) i wish find smallest value occurs after largest value. in example above, 4 or a7 , not a2 . i have tried use dmin , combination of min plus if functions, return smallest value, not smallest after largest. thank you! try this: =min(if((max(if(a1:a8=max(a1:a8),row(a1:a8)))<row(a1:a8))*a1:a8>0,a1:a8)) you need enter ctrl + shift + enter .

get the uploaded form data using jquery -

how details of form before post in following way, or @ least details of file(name, size etc..) {"photo":{"name":"vishnuvardhan.siddareddy@fisglobal.com_f16.pdf","type":"application\/pdf","tmp_name":"\/tmp\/phpghorhj","error":0,"size":72057}} if alert(formdata), showing [object formdata]. jquery code $("#applybtn").click(function(){ var formobj = $('#multiform'); var formurl = formobj.attr("action"); var formdata = new formdata(this); alert(formdata); return false; $.ajax({ url: formurl, type: "post", data: formdata, mimetype:"multipart/form-data", contenttype: false, cache: false, processdata:false,

osx - GStreamer SDK installation on Mac -

can please let me know proper steps installing gstreamer sdk on mac. followed steps on following website: http://docs.gstreamer.com/display/gstsdk/installing+on+mac+os+x after installing runtime , development files cannot find: library/frameworks/gstreamer.framework/current/share/gst-sdk/tutorials . cannot see current folder. new gstreamer mac. first of all, gstreamer.com ist not part of official gstreamer project. project's url http://gstreamer.freedesktop.org/ . the sdk available on gstreamer.com based upon gstreamer 0.10.x release. these versions have not been maintained gstreamer project couple of years already. current stable version 1.4.x. i suggest getting sdk official gstreamer project page , start reading documentation found there. returning original question. apple decided hide personal library folder. can reach described in kb: https://support.apple.com/kb/ph18928 the library folder hidden. if need open reason, click desktop make sure y

linq - How to save subquery result? -

i have such query: var result = tsr in db.tsr tsr.someid = x tsr.sequence > ((from tsr2 in db.tsr tsr2.someid = y tsr2.fitid = tsr.fitid select tsr2.sequence)).firstordefault() select new myclass() { properties = tsr.properties // (simplicified) } i wonder how select tsr2.sequence value newclass object? select new myclass(){ myclass.property1 = tsr.sequence.propertyx, myclass.property2 = tsr.sequence.propertyy, myclass.property3 = tsr.sequence.propertyz, ...... } you can select , assign properties 1 one. , sure myclass object properties public

Make django not to process commented out html -

this question has answer here: how put comments in django templates 4 answers i developing website using django. added link element yet create view it. but django doesn't let me test changes until finish writing view. issues noreversematch error. tried commenting out part of html using these <!-- xxxx --> still django issues same error. how can comment out html djano won't process it. surround parts of template template comment tag , , django ignore it: {# <a href="{% url('does-not-exist') %}">foo</a> #} in text editors aware of django templates, can hit ctrl + / comment out templates.

php - laravel 5 search query issue -

i need search filtering different columns db table, filtering columns groupa, groupb , groupc, each column has 1 of following values high, low, moderate in db table but front end user have anther value called "none", value not contain in database. this current query public function show($groupa, $groupb, $groupc) { $fodmaps = fodmap::where('groupa', '=', $groupa)->where('groupb', '=', $groupb)->where('groupc', '=', $groupc)->get(); return $fodmaps; } what want if user search value not contain in db (high/low/moderate) should search other columns except 1 have unmatching values ex: http://url/api/fodmap/groupa=low/groupb=low/groupc=high if user enter above way should display results according values but if user inputs following http://url/api/fodmap/groupa=low/groupb=low/groupc=none since "none" value in groupc column not exit should search other 2 columns with

Error events 50000780 in Event Log on Azure, what do they mean? -

Image
in azure web site's event log see same error every 1-5 minutes: 1 [varies] 5 50000780 what error message mean? thank in advance! i found similar issue , albeit sharepoint , lightswitch. looks had similar error number show in event logs, breaking down xml output: <event xmlns="http://schemas.microsoft.com/win/2004/08/events/event"> <system> <provider name="iis express" /> <eventid qualifiers="32768">2284</eventid> <!-- searched on --> <level>3</level> <task>0</task> <keywords>0x80000000000000</keywords> <timecreated systemtime="2013-09-14t03:48:18.000000000z" /> <eventrecordid>8608</eventrecordid> <channel>application</channel> <computer>psn-w12s-720</computer> <security /> </system> <eventdata> <data>1</data> <data>5</

javascript - Google maps API, custom marker issue (Can't really explain in the title) -

this question has answer here: google maps js api v3 - simple multiple marker example 11 answers so, have following javascript code custom markers: window.addeventlistener('load', initialise) //initialises map view function initialise() { var mapoptions = { center: new google.maps.latlng(53.4113594, -2.1571162), zoom: 14, maptypeid: google.maps.maptypeid.roadmap }; //creates actual map object var map = new google.maps.map(document.getelementbyid("maparea"), mapoptions); setmarkers(map, mylocations); } var mylocations = [ ['stockport town hall', 'this town hall. things... happen.', 'townhall.jpg', 53.406, -2.158215, 'images/markers/townhall.png'], ['stockport town centre', 'this centre of town. there shops. , food. and... stuff', 'stockportcen

python - How can I test celery.crontab schedule executes at expected time? -

current crontab settings here: crontab(day_of_month=2, hour=2, minute=0) but can't figure out how schedule correctly executed on code. there way test celery crontab schedule? try cron.remaining_estimate(datetime.now())

java.lang.NullPointerException with variable having a value (Eclipse) -

i have looked throughout web try find answer error, nothing have found matches error or fail understand relation. here error running on eclipse: java.lang.nullpointerexception ca.sheridancollege.controllers.cardealership.doget(cardealership.java:63) javax.servlet.http.httpservlet.service(httpservlet.java:622) javax.servlet.http.httpservlet.service(httpservlet.java:729) org.apache.tomcat.websocket.server.wsfilter.dofilter(wsfilter.java:52) and here code: package ca.sheridancollege.controllers; import java.io.ioexception; import java.sql.connection; import java.sql.drivermanager; import java.sql.preparedstatement; import java.sql.resultset; import java.sql.sqlexception; import javax.servlet.servletexception; import javax.servlet.annotation.webservlet; import javax.servlet.http.httpservlet; import javax.servlet.http.httpservletrequest; import javax.servlet.http.httpservletresponse; /** * servlet implementation class cardealership */ @webservlet

excel - VBA Windows(Index).Activate causes Run-time error '9': Subscript out of range -

i have almost-complete vba macro runs fine until reaches line: windows(temp_name).activate when run following error: run-time error '9': subscript out of range temp_name name of file need return to. here lines around (tell me if more lines necessary): next ind application.cutcopymode = false workbooks.opentext filename:=cpath _ , origin:=437, startrow:=1, datatype:=xldelimited, textqualifier:= _ xldoublequote, consecutivedelimiter:=false, tab:=false, semicolon:=false _ , comma:=true, space:=false, other:=false, fieldinfo:=array(array(1, 1), _ array(2, 1), array(3, 1), array(4, 1), array(5, 1), array(6, 1), array(7, 1), array(8, 1), _ array(9, 1), array(10, 1), array(11, 1), array(12, 1), array(13, 1)), _ trailingminusnumbers:=true ind1 = 1 iplateno tlcorn = "b" + cstr(istartrow + (ind1 - 1) * istep) brcorn = "m" + cstr(istartrow + 7 + (ind1 - 1) * istep) rangenout = tlcorn + ":" + brcorn rangenin = tl

Error with Excon when uploading to rackspace with Fog -

very recently, uploading of files rackspace cloud has started erroring on mac , 1 other mac in our office. same code base works fine on ubuntu servers , on third mac in office. error reports (excon::errors::socketerror) illegal seek (errno::espipe) pointing gems/excon-0.31.0/lib/excon/connection.rb:186:in `pos='" this has been baffling me days. macs osx 10.9. if can offer assistance appreciated. versions: fog(1.20.0) excon(0.31.0)

c# - How to animate TranslateTransform and ScaleTransform in WPF -

i'm trying animate translatetransform , scaletransform of rectangle @ same time using storyboard in code-behind. studied similar questions how i'm still stuck @ first step. <grid> <grid.rowdefinitions> <rowdefinition height="*"/> <rowdefinition height="*"/> </grid.rowdefinitions> <rectangle x:name="myrectangle" width="100" height="100" fill="aqua"></rectangle> <button grid.row="1" content="animate" click="buttonbase_onclick"/> </grid> private void buttonbase_onclick(object sender, routedeventargs e) { var translate_x = new doubleanimation() { = 0, = 100, duration = timespan.fromseconds(5), }; var translate_y = new doubleanimation() { = 0, = 100, duration = timespan.fromseconds

actionscript 3 - Change BackgroundColor of particular row dynamic in DataGrid in flex -

i trying change mx datagridcolumn background color depend on it's data dynamically didn't get/found solution that. <mx:datagrid id="orderdg" dataprovider="{orderslist}" > <mx:columns> <mx:datagridcolumn width="30" headertext="number" datafield="no" /> <mx:datagridcolumn width="250" headertext="fname" datafield="fname"> <mx:datagridcolumn width="250" headertext="lname" datafield="lname"> </mx:columns> </mx:datagrid> now, suppose want make row color green if fname=abc , color red if fname=xyz . how can change background , text color of row. edit: i try creating custom renderer following way. override protected function updatedisplaylist(unscaledwidth:number, unscaledheight:number):void { super.updatedisplaylist(unscaledwidth

Spring Boot swallowing Access-Control-Request-Headers on OPTIONS preflight -

i have spring boot rest application has simple cors filter on it. want dynamically respond values in access-control-request-headers header, rather provide specific list. common wisdom seems explicitly set values returned in "access-control-allow-headers", white-listing set of origins , want allow headers send. cannot find way parrot value of access-control-allow-headers in access-control-request-headers. here's code @override public void dofilter(servletrequest servletrequest, servletresponse servletresponse, filterchain filterchain) throws ioexception, servletexception { httpservletresponse response = (httpservletresponse) servletresponse; response.setheader("access-control-allow-origin", "*"); response.setheader("access-control-allow-methods", "post, put, get, delete, options"); // need enable other methods when/as implemented response.setheader("access-control-max-age", "3600");

css - how to draw a vertical line in html using position:relative -

Image
just out of curiosity, possible draw vertical line in html? i've succeeded on doing horizontal line using <hr> tag setting position position:relative , z-index: -9999 make go behind colored boxes. (the colored boxes here represent different images. sorry terrible drawing) when try apply <hr style="position: relative; width:0px; height:50px; top: 100px;"> the other horizontal lines i've created earlier aren't placed same before. using similar style both horizontal , vertical lines. idea on how or why happens? or impossible do? thanks in advance! <div class="test"></div> sample div created set height how u need .test{height:100px; width:0px; position:relative; border-left:1px solid gray;} this work

Parse Daunting JSON: PHP -

so have huge json chunk of data need parse. has been converted php array json_decode . below 1 element of data object in php array. there hundreds of these elements, below one: '{ "data": [ { "id": 3215, "user_id": { "id": 99106, "name": "rusty shackleford", "email": "rusty.shackleford@company.com", "has_pic": true, "pic_hash": "somehash", "active_flag": true, "value": 99106 }, "person_id": { "name": "rusty shackleford", "email": [ { "label": "work", "value": "rusty shackleford@email.com",

ios - How to make the UIButton title label font same in size regardless of the text width -

Image
i generating few buttons should tabbar. have done. scroltab=[[uiscrollview alloc] initwithframe:cgrectmake(0, h-48, w, 48)]; [scroltab setcontentinset:uiedgeinsetsmake(0.0, 0.0, 0.0, 180.0)]; [scroltab setshowshorizontalscrollindicator:no]; [self.view addsubview:scroltab]; (int i=1; i<6; i++) { [scroltab addsubview:[self gettabbaritems:i :5]]; } then gettabbaritems method this. -(uibutton *)gettabbaritems :(nsinteger)index:(nsinteger)count { uibutton *item=[[uibutton alloc] initwithframe:cgrectmake(tabbuttonx, 0, w/count,49)]; [item.titlelabel setfont:[uifont fontwithname:@"helveticaneue-light" size:10.0]]; item.titlelabel.numberoflines = 1; item.titlelabel.adjustsfontsizetofitwidth = yes; item.titlelabel.linebreakmode = nslinebreakbyclipping; cgsize imagesize=item.imageview.image.size; cgfloat space=6.0; if (index==1) { [item settitle:@"menu" forstate:uicontrolstatenormal]; [item setimage:[uiimage imagenamed:@"menubtn&quo

How to make associative array using PHP for loop to use in Yii 2 array map()? -

i make associative array using php loop use in yii2 map() method. the array in bellow format- $listarray = [ ['id' => '1', 'name' => 'peter/5'], ['id' => '2', 'name' => 'john/7'], ['id' => '3', 'name' => 'kamel/9'], ]; the id , name changed through each iteration of loop. here, name hold customized value after calculation inside loop. finally, list used in map() method following $listdata=arrayhelper::map($listarray,'id','name'); i can use map() method directly after using active record find list array , use in map() method. not give me way use custom value name attribute. $listarray = userlist::find() ->where(['status' => 1]) ->orderby('name') ->all(); $listdata=arrayhelper::map($listarray,'id','name'); how can achieve this? direct source code example great me.

ios - How to create a Objective-c Prefix.pch header file for swift project -

this question has answer here: why .pch file not available in swift? 1 answer how call objective-c code swift 12 answers right have swift project, , add objective-c files project. objective-c files have prefix header file don't have import every 1 of them each objective-c files. know how in objective-c project. right in swift project. how it?

How to make Django pass cookies when communicating with Node.js server using socket.io? -

i developing instant messaging feature apps (ideally cross platform mobile app/web app), , out of ideas fix issue. far, have been able make work locally, using node.js server socket.io, django, , redis, following tutorials online suggest. step @ consists in putting in cloud using amazon aws. django server , running, created new separate node.js server, , using elasticache handle redis part. launch different parts, , no error shows up. however, whenever try using messaging feature on web, keep getting error 500: handshake error i used console check request header, , observed cookies not in there, contrary when on localhost. know necessary authorize handshake, guess that's error coming from.. furthermore, have checked cookies exist, not set in request header. my question then: how can make sure django or socket client (not sure who's responsible here..) puts cookies in header?? one of ideas maybe supposed put on same server, different ports, instead of 2 separate se

Call a c++ dll with stl container from .net -

having following function in native dll: double sum (std::vector<double> vals) { double s = 0.0; (size_t = 0; < vals.size(); i++) { s += vals[i] } return s; } how can make callable .net (c#) ? the problem is, there no pair vector<double> . is possible alter c++ side make call possible? (without giving std c++ feature, including ability call other c++ libraries ) it not possible , should not done: do not pass stl classes on dll interface however create c-function called c#. parameters pass c-array of doubles , second parameter - length of array. wrapper function convert std::vector , call original function. double sumwrapper(double* pointertodoublearray, unsigned int numberofelements) { //convert , call sum } this c-function can called c++ using custom marshalling described here . option simple wrapper generator ( swig ) auto - generate c-wrapper function , c# function calls c++ function in dll. the other option

html - Multiple buttons in input group -

Image
i'm trying implement input group has multiple buttons on left , 1 button on right shown in image: the problem is, have more 1 button per side, input field resizes max width , kicks 1 button out on smaller displays: with button on left , button on right, works 100% on screen sizes: le code: <div class="input-group br"> <span class="input-group-btn"> <div class="btn-group"> <a href="#" class="btn btn-primary clear-search"> <span class="glyphicon glyphicon-refresh"></span> </a> <a href="#" class="btn btn-primary qr-code"> <span class="glyphicon glyphicon-qrcode"></span> </a> </div> </span> <input class="form-control search" type="s

google chrome - Can I get the command line information of running browser using Javascript directly or indirectly? -

can command line information of running browser using javascript directly or indirectly? for example - information below: command line "c:\program files (x86)\google\chrome\application\chrome.exe" --flag-switches-begin --flag-switches-end i don't thinks possible since browsers run js code in sandboxed environment. here list of can javascript in browser https://developer.mozilla.org/en/docs/web/api

ajax - Angular ui router (extras) $stateChangeStart event trigger twice -

can explain me why angular ui router extras addition trigger twice (on init!) $statechangestart event in case when have async ajax check , e.preventdefault() call? short event code example: $rootscope.$on("$statechangestart", function (e, tostate, toparams, fromstate, fromparams, error) { console.log("$statechangestart");//fired twice if(!user.data) { e.preventdefault(); $http.get("https://randomuser.me/api/") .success(function(data, status, headers, config) { console.log(data); user.data = data; $state.go(tostate, toparams); }); } }); full fiddle example without extras addition working expected. tnx angularjs has multiple checks during digest cycle check before , after changes, may part of cycle. you can see behavior during $watch. $scope.$watch('myvariable', function( change

tibco - Does Spotfire provide any simple way of creating an "Other" category to group entries within a filter? -

right now, using filtering scheme looks @ data of 5 or 6 common entries in 'clinic' field. but, there handful of other possibilities might account few rows each. inconsequential include on own (i using pie charts , bar charts), these rows accounted for. reason, create "other" category groups these entries together. best way of doing this? know can create calculated column groups aside top 5 or 6 in other category, thought there might way keep working original column , achieve same result. unfortunately not. in 6.5.x have write case statement specify not common other. in 7.0.x can go insert binned column. add bottom can use values create bin. add values want bin , call them "other". of course if @ column created this, case statement. whole lot faster writing yourself.

Android: Get initialization code to run every time user launches app -

Image
i have app main activity (a) menus, , separate activities (b, c, d) tasks selected menu. have initialization code in oncreate(). if user leaves app pressing home button, , re-launches tapping app icon, oncreate() not run. cannot put initialization code in onrestart(), runs when user returns menu after task run b. how can code run on every launch, on launch? first need understand how android life cycle works: http://developer.android.com/training/basics/activity-lifecycle/index.html basically, need run code on onresume , onstart depending on want achieve edit: since icon launches view intent, check intent when application resumed or restarted.

.htaccess - Simple RegeX going wrong -

i'm trying redirect 2 pages. /blog.php /blog/ and blog/?p=1 /blog/ i have 1 working now. rewriterule ^blog\/$ blog.php rewriterule ^blog\/$ blog\/?p=1 [l] can't figure out how combine these two. can ? you can use: rewritecond %{query_string} ^p=1$ [nc] rewriterule ^blog/?$ blog/? [nc,r=301,l] rewriterule ^blog\.php$ blog/ [nc,r=301,l]

ios - Take Screenshot of UIImageView and UILabel then Share it -

Image
i think i'm near solving problem. i've uitableview prototype cell looks this: gray-scale background image see coming server , text overlay text uilabel on , change on every image in server. it's two layers i'm trying send. third red button button of share , select share image in email function called: -(uiimage *)makeimageofcell:(nsuinteger)sender { homecell *cellobj; cellobj.tag = sender; uigraphicsbeginimagecontext(cellobj.homeimg.frame.size ); [cellobj.homeimg.layer renderincontext:uigraphicsgetcurrentcontext()]; [cellobj.overlaytext.layer renderincontext:uigraphicsgetcurrentcontext()]; uiimage *viewimage = uigraphicsgetimagefromcurrentimagecontext(); uigraphicsendimagecontext(); return viewimage; } in -(void)sharebuttonclicked:(uibutton*)sender i've written code of sharing. in function want send image. here i'm doing: uiimage *imagetoshare = [self makeimageofcell:sender.tag]; calling makeimageofcell function

html - Centering and floating within the same container -

i have 1 container having content centered in want put on left , having trouble figuring out how this. is way absolute positioning? here code have been playing around show ads example: html: <div class="container"> <p class="one">left</p> <p style="clear: both;"></p> <div class="center">center</div> </div> css: .container { background-color: gray; text-align: center; } .container .one { float: left; background-color: aqua; } .clearfix:after, .clearfix:before { display: table; content: " "; clear: both; } .container .center { display: inline-block; background-color: green; } codepen: http://codepen.io/anon/pen/nqebnp try applying display:inline-block , float:left width of both div. .container { background-color: gray; text-align: center; overflow: auto; } .container .one { display: inline-block; float: left;

Getting error while creating type "table" in SQL Server -

i creating type table , query as: create type dbo.tbl table(country_code varchar(5), country_name varchar(150), country_capital varchar(150), continent_code char(2) ); but when execute it, error: msg 156, level 15, state 1, line 1 incorrect syntax near keyword 'as'. please suggest solution

http - Server Only Respond to certain Posts (Security) -

ok have 0 experience in dealing security, need little guidance. have 2 servers communicate through http request. want make sure servers execute requests come 1 another. have no idea how block out other requests or verify request real. need tell me direction head in solve problem. thanks! you can lot of things ensure these 2 servers , no-one else talks them port blocking - have 1 port open on each server listen on. port unknown other users cant communicate of servers. ip blocking - safest method. block incoming requests dont match ip of other server mutual authentication - theres bunch of mutual authentication algorithms available. use 1 of them ensure server youre talking other server , nothing else miscellaneous - key sharing, public key cryptography, digital signatures etc.. tbh question bit broad answer in detail. have research on these methods , figure out 1 best suites usecase.

jquery - What specifically is wrong with the JavaScript that I've provided? -

i new javascript, have prior experience front-end development whole. attempting have js iterate on list provided , display results on site. each item displayed once before moving onto next in list. when reaches end, last item permanently displayed. using textillate js library. what's wrong code? <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <script> var title-transitions = [ "create solutions", "build relationships", "design brands", "redifine excellence" ], transitioncounter = 0, looped = false, textillatesettings ={ loop:false, in:{ callback:fucntion(){ if(!looped) $('h1.introduction-heading').fadeout(3800); } } }; var $h1 = $('h1.introduction-heading'); $h1.introduction-heading(textillatesettings); var animationhero = set interval(function(){ transitioncounter

vim - How do you apply a macro x amount of times per line where x depends on the line -

say have like a & 1234567890 b & 1234567890 c & 1234567890 d & 1234567890 e & 1234567890 f & 1234567890 is there way use vim macro such can run macro/command x amount of times per line, x depends on line? in case, run 2wx^ on each line x times, x line number such result becomes a & 234567890 b & 34567890 c & 4567890 d & 567890 e & 67890 f & 7890 thanks in advance if macro recorded in register q , can run: :exec 'normal ' . line('.') . '@q' on line want. macro want cursor kept on 1st column before being run. you can - better - in different way, if describe what want do. example, perhaps skip macro altogether , use instead: :exec 'normal ^2w' . line('.') . 'xj' if need line offset (e.g. of 1 ), use: :let nr = line('.') - 1 | execute 'normal ^2w' . nr . 'xj'

python - Using tkFont from tkinter to identify if a font (Helvetica-Light) is available/installed -

we have django application, , utilize html pdf generation tool build pdf documents. have run problems fonts not existing on server converting html pdfs, , want add unit test can verify if font exists on hosting server. from have learned, should using tkinter's tkfont module available fonts list, , confirm fonts using found within list. class verifyfontsexistonserver(basetransactiontestcase): def test_if_font_exists(self): import tkinter import tkfont tkinter.tk() installed_font_families =[i in tkfont.families() if 'helvetica' in or 'courier' in or 'dejavuserif' in or 'ocra' in i] font in installed_font_families: log.info('{0}'.format(font)) but when list items out, helvetica font, not helvetica-light. believe part of family, there way iden

database - MySQL inquiry does not make difference when using order by -

i create table like: create table my_table ( value int(20) ) engine=innodb default charset=utf8; and insert data: mysql> select * my_table; +-------+ | value | +-------+ | 0 | | 1 | | 2 | | 3 | +-------+ when execute select count(value), value my_table; , select count(value), value my_table order value desc; , both show: +--------------+-------+ | count(value) | value | +--------------+-------+ | 4 | 0 | +--------------+-------+ my question is: why column @ right side 0? why order value desc doesn't make difference here? order by processed after generates results. when use aggregate function count() without group by , aggregates selected rows, , produces 1 row of results. non-aggregated columns come indeterminate rows; order by clause has no effect on how row selected.

c# - Sorting mechanism not getting applied when a partial view is rendered in a view using @Ajax.ActionLink -

i working on mvc 4 project. i've done provided ajax action link on view. @ajax.actionlink("display resources", "resources", "resources", null, new ajaxoptions { httpmethod = "get", insertionmode = insertionmode.replace, updatetargetid = "showallresources"}); and on action link i've rendered 1 partial view display table database. showallresources div in display partial view. in partial view i've provided 3 different ajax action links sort data. <th> @ajax.actionlink("first name", "resources", new { sortorder = viewbag.firstnamesort }, new ajaxoptions { httpmethod="get"}) </th> <th> @ajax.actionlink("last name", "resources", new { sortorder = viewbag.lastnamesort }, new ajaxoptions { httpmethod = "get" }) </th> <th> @ajax.actionlink("release date&

elasticsearch - Logstash File Input not outputting event after file change -

i trying read file , output each events console (or file). want able add file , have picked logstash , repeat pipeline. however, logstash seems read , perform pipeline once though sees file has changed. i developing on os x yosemite. here's logstash config input { file { path => "/users/justin/logstash-1.5.2/testfile" sincedb_path => "/users/justin/logstash-1.5.2/.sincedb" start_position => "beginning" } } output { stdout { } } here's log (also, tried sudo, no luck): justins-macbook-pro-2:logstash-1.5.2 justin$ bin/logstash agent --debug -vf myconfig reading config file {:file=>"logstash/agent.rb", :level=>:debug, :line=>"295", :method=>"local_config"} compiled pipeline code: @inputs = [] @filters = [] @outputs = [] @periodic_flushers = [] @shutdown_flushers = [] @input_file_1