Posts

Featured post

Perl - how to grep a block of text from a file -

it can in xml or text format. how in general grep block of text in perl? <track type="ws"> <range> <rangestart>0</rangestart> <rangeend>146.912</rangeend> <locationindex>0</locationindex> <propertyindex>0</propertyindex> </range> </track> <track type="ps" id="1"> <range> <rangestart>0</rangestart> <rangeend>146.912</rangeend> <locationindex>1</locationindex> <propertyindex>1</propertyindex> </range> </track> i want grep type="ps" , till </range> . one solution open file, read line line , match block. open(fh, "file.txt"); foreach $line (<fh>) { if ($line =~ m/type="cc"(.*?)<\/range>/) { print $1; } } but there more optimal solution without reading file line l

android Nullpointerexception with intent data=null always -

i creating app, contains 3 activities, say, a, b , c. activity main activity, launches when app opens. activity called activity b using startactivityforresult(intent, 1); activity b returns result, captured, , within onactivityresult of activity a, launching activity c using startactivityforresult(intent2, 2); here onactivityresult activity a @override protected void onactivityresult(int requestcode, int resultcode, intent data){ log.d("main","inside on activity result requestcode : " + requestcode); if(requestcode == 1){ if(resultcode == result_ok){ log.d("mainact", "inside result code ok"); if(data.getstringextra("puzzleid")!=null){ log.d("mainact", "inside puzzle has been selected"); string puzzleidresult = data.getstringextra("puzzleid"); intent puzzleintent = new intent(mainactivity.this, trialactivity.cla

delphi - How to remove all the grips on a coolbar if I have several coolbands? -

Image
if set mycoolbar.fixedorder true,only grip on first band hidden. well,if use delphi 7 create vcl forms application,then put coolbar on , create 3 coolbans hold other controls,only grip , top coolbands can hidden setting mycoolbar.fixedorder:=true. i've uploaded picture make things clear. you got fixedorder property wrong. fixed property not allow bands rearranged if set true . setting property of coolbar true keep user changing bands order @ runtime, user can still move , resize bands. can give advice can do, actual solution problem, well, have wait answer. my advice use 3 coolbars in row , setting "fixedorder" property true , bandborderstyle bsnone . way grip hidden on of them. about property, it's not bug of ide, actual preference of property.

mysql - Can PHP 5.4 run on PHP 5.3 configured server -

first of all, novice web developer. my question "a website developed php 5.4 can run on php 5.3 configured server?" (detail description) configure myself apache 2.4, mysql 5.6 , php 5.4.12 on windows. everything's ok. errors occur when changed website folder machine configured wampserver. wampserver configured apache 2.2.11, php 5.3 , mysql 5.1.36. i install mysql 5.6 on machine , database connected. "parse error occur code" such $country = mysql_fetch_row(querymysql("----"))[0]; in addition, showed other errors such "table 'emp.productcateogry' doesn't exist". please, give me suggestions. the short answer is: no, should not expect to, if using new features of php 5.4 within code. the specific error referring with: parse error occur code is because line $country = mysql_fetch_row(querymysql("----"))[0]; is using new feature: function array dereferencing which, prior php

connection - Bluecove : restart bluetooth stack programmically -

i'm trying close bluetooth service, bluecove has bug on connection close method ( https://code.google.com/p/bluecove/issues/detail?id=90 ) , trying workaround restart service. think restarting bluetoot stack solve problem. can programmically? i'am using microsoft bluetooth stack. problem solved in way. i restart application, firstly shut down bluecove manually. bluecoveimpl.shutdown(); if restart application, bluecove shut down, cannot initialize bluetooth stack during start. here restart method: public static void restartapplication(runnable runbeforerestart) throws ioexception { try { // java binary string java = system.getproperty("java.home") + "/bin/java"; // vm arguments list<string> vmarguments = managementfactory.getruntimemxbean() .getinputarguments(); stringbuffer vmargsoneline = new stringbuffer(); (string arg : vmarguments) {

how to use preloader in Grid View in android -

Image
i want use preloader image in gridview images when loading form remote server. while loading server @ time want show preloader image this(same progress bar or progress bar). i want show small progress bar there in gridview image item or preloader image dnt know can use me achieve this. can please me how can thing in android. i want make ios. image form ios. here android layout xml file : activity_image_grid.xml <?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content" > <include android:id="@+id/title_bar" android:layout_alignparenttop="true" layout="@layout/activity_top_header_bar" /> <gridview android:id="@+id/gridview" android:layout_width="fill_parent" an

javascript - Animating array of divs; only the final element is modified -

this baffling me @ moment. i'm experienced programmer looking throw bit of surprise fiancee on countdown page our wedding. desired effect simulated confetti falling behind main page. setup follows: i have array of divs in javascript. each div absolutely positioned on page. have interval set updates every 50 or milliseconds. on each tick, run loop on array of divs, , calculations , update positions. problem problem having, however, though can see divs created, stored array, , modified (in case, each has slight randomized rotation) during initialization phase, once tick update position starts, div stored in whatever last slot of array gets position updated. tried hard-coding each div index testing purposes, strictly last element update position. upon printing current "left" , "top" style values each div before , after calculations shows value has been changed, no visible change noticeable. here's basic code: javascript var container;