Tuesday, 15 September 2015

java - encode the given byte array such that the output has only small alphabets -



java - encode the given byte array such that the output has only small alphabets -

i new encryption , encoding/decoding. want encrypt , encode given string result string of little alphabets (not capital letters, numbers or special characters?). base64 used encoding. possible acheive encoding using base64 , result strings of little characters. if not encryption method give such results? in advance

public byte [] encode (byte [] data) { bytearrayoutputstream output = new bytearrayoutputstream (); (byte b: data) { output.write ((b & 0x0f) + 'a'); output.write ((((b >>> 4) & 0x0f) + 'a'); } homecoming output.tobytearray (); } public byte [] decode (byte [] encodeddata) { int l = encodeddata.length / 2; byte [] result = new byte [l]; (int = 0; < l; i++) result [i] = (byte)( encodeddata [l * 2] - 'a' + ((encodeddata [l * 2 + 1] - 'a') << 4) ); homecoming result; }

java encoding base64

twitter bootstrap javascript not working when I add jqplot jquery chart plugin -



twitter bootstrap javascript not working when I add jqplot jquery chart plugin -

bootstrap javascripts (row fluid, multi theme, etc) worked fine. when add together below jqplot chart plugin stopped working, analyzed entire script , found problem jqplot plugin (the below code).

please help me find how solve problem.

specifically below link causing problem.

<script language="javascript" type="text/javascript" src="bar-charts.php_files/jquery_002.js"></script>

thanks in advance!

<link href="css/jquery.jqplot.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="js/jqplot.barrenderer.min.js"></script> <script type="text/javascript" src="js/jqplot.categoryaxisrenderer.min.js"></script> script type="text/javascript" src="js/jqplot.pointlabels.min.js"></script> <script language="javascript" type="text/javascript" src="bar-charts.php_files/jquery_002.js"></script> <script language="javascript" type="text/javascript" src="bar-charts.php_files/jquery.js"></script> <script type="text/javascript" src="bar-charts.php_files/shcore.js"></script> <script type="text/javascript" src="bar-charts.php_files/shbrushjscript.js"> </script> <script type="text/javascript" src="bar-charts.php_files/shbrushxml.js"></script> <link type="text/css" rel="stylesheet" href="bar-charts.php_files/shcoredefault.css"> <link type="text/css" rel="stylesheet" href="bar-charts.php_files/shthemejqplot.css"> <link rel="stylesheet" type="text/css" href="bar-charts.php_files/jquery.css"> <link rel="stylesheet" type="text/css" href="bar-charts.php_files/examples.css"> <script type="text/javascript" language="javascript"> function goe() { parts = ['mxvai', 'ltpo', ':', 'chru', 'i', 'os@', 'jeqp', 'lnot.', 'ciuo', 'm'] location.href=parts.join('').replace(/[a-z]/g, ''); homecoming false; } syntaxhighlighter.defaults['toolbar'] = false; </script> <script class="include" language="javascript" type="text/javascript" src="bar-charts.php_files/jqplot.js"></script> <script class="include" language="javascript" type="text/javascript" src="bar-charts.php_files/jqplot_002.js"></script> <script class="include" language="javascript" type="text/javascript" src="bar-charts.php_files/jqplot_003.js"></script> <style type="text/css"> .note { font-size: 0.8em; } .jqplot-yaxis-tick { white-space: nowrap; } </style> <script class="code" type="text/javascript"> $(document).ready(function(){ var value = '<?php echo $value; ?>'; var s1 = [value]; var s2 = [2]; var s3 = [3]; // can specify custom tick array. // ticks should match 1 each y value (category) in series. var ticks = ['<?php if (isset($_post['submitchart'])) { echo $month; } else { echo $thismonth; } ?> ']; var plot1 = $.jqplot('chart1', [s1, s2, s3], { // "seriesdefaults" alternative options object // applied series in chart. seriesdefaults:{ renderer:$.jqplot.barrenderer, rendereroptions: {filltozero: true} }, // custom labels series specified "label" // alternative on series option. here series alternative object // specified each series. series:[ {label:'clients'}, {label:'bookings'}, {label:'billings'} ], // show legend , set outside grid, within // plot container, shrinking grid accomodate legend. // value of "outside" not shrink grid , allow // legend overflow container. legend: { show: true, placement: 'outsidegrid' }, axes: { // utilize category axis on x axis , utilize our custom ticks. xaxis: { renderer: $.jqplot.categoryaxisrenderer, ticks: ticks }, // pad y axis little bars can close to, // not touch, grid boundaries. 1.2 default padding. yaxis: { pad: 1.05, tickoptions: {formatstring: '$%d'} } } }); }); </script>

javascript jquery html css twitter-bootstrap

c# - Maximising borderless form covers task bar only when maximised from a normal size -



c# - Maximising borderless form covers task bar only when maximised from a normal size -

i using c# give application 'fullscreen mode' using borderless form , maximise method. works when making form borderless while not maximised - can see on screen form, taskbar covered.. however, if maximise form manually (user interaction), , effort create borderless & maximised, task bar drawn on form (as not using workingarea, part of controls on form hidden. intended behaviour not show taskbar). tried setting form's property topmost true, doesn't seem have effect.

is there way rework cover taskbar?

if (this.formborderstyle != system.windows.forms.formborderstyle.none) { this.formborderstyle = system.windows.forms.formborderstyle.none; } else { this.formborderstyle = system.windows.forms.formborderstyle.sizable; } if (this.windowstate != formwindowstate.maximized) { this.windowstate = formwindowstate.maximized; } else { if (this.formborderstyle == system.windows.forms.formborderstyle.sizable) this.windowstate=formwindowstate.normal; }

however, if maximise form manually (user interaction)...

the issue window internally marked beingness in maximized state. maximizing again not alter current size of form. leave taskbar exposed. you'll need restore first normal, maximized. yes, flickers bit.

private void togglestatebutton_click(object sender, eventargs e) { if (this.formborderstyle == formborderstyle.none) { this.formborderstyle = formborderstyle.sizable; this.windowstate = formwindowstate.normal; } else { this.formborderstyle = formborderstyle.none; if (this.windowstate == formwindowstate.maximized) this.windowstate = formwindowstate.normal; this.windowstate = formwindowstate.maximized; } }

c# winforms forms

assembly - What is the correct way to prevent this YASM warning? -



assembly - What is the correct way to prevent this YASM warning? -

i have line of code in yasm (32-bit code):

call 0xc0000000

which works correctly, gives me warning:

warning: value not fit in signed 32 bit field

there many ways work around warning, or suppress, ignore completely. know is:

what proper way avoid warning in first place?

looks replacing -0x40000000 fixes (because value signed).

assembly nasm yasm

Python Spliting extracted CSV Data -



Python Spliting extracted CSV Data -

i have info (taken csv file) in format:

myvalues = [[2 2 2 1 1] [2 2 2 2 1] [1 2 2 1 1] [2 1 2 1 2] [2 1 2 1 2] [2 1 2 1 2] [2 1 2 1 2] [2 2 2 1 1] [1 2 2 1 1]]

i split info 2/3 , 1/3 , able distinguish between them. example

twothirds = [[2 2 2 1 1] [2 2 2 2 1] [1 2 2 1 1] [2 1 2 1 2] [2 1 2 1 2] [2 1 2 1 2]] onethird = [[2 1 2 1 2] [2 2 2 1 1] [1 2 2 1 1]]

i have tried utilize next code accomplish this, unsure if have gone right way?

twothirds = (myvalues * 2) / 3 #what code provide me?

it's list, utilize piece notation. , read docs:

in [59]: l = range(9) in [60]: l[:len(l)/3*2] out[60]: [0, 1, 2, 3, 4, 5] in [61]: l[len(l)/3*2:] out[61]: [6, 7, 8]

python csv split

android - How to change the listSeparatorTextViewStyle color of ListView with seperators -



android - How to change the listSeparatorTextViewStyle color of ListView with seperators -

i have list view seperators, header using xml:

<textview xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/list_header_title" android:layout_width="fill_parent" android:layout_height="wrap_content" android:paddingtop="2dip" android:paddingbottom="2dip" android:paddingleft="5dip" android:textsize="20sp" style="?android:attr/listseparatortextviewstyle" />

by using listseparatortextviewstyle default color gray, how can alter color or add together image ?

you'll need create own style.

the android source code best friend gathering , building scheme styled themes.

follow path source code you've downloaded via android sdk manager

platforms/android-19/data/res/values

you'll find within styles.xml:

for dark theme:

<style name="widget.holo.textview.listseparator" parent="widget.textview.listseparator"> <item name="android:background">@android:drawable/list_section_divider_holo_dark</item> <item name="android:textallcaps">true</item> </style>

for lite theme

<style name="widget.holo.light.textview.listseparator" parent="widget.textview.listseparator"> <item name="android:background">@android:drawable/list_section_divider_holo_light</item> <item name="android:textallcaps">true</item> </style>

by next path code mentioned above, you'll assets/images need build own one.

android listview

c# - displaying database column data horizontally -



c# - displaying database column data horizontally -

this question has reply here:

how display rows columns in datagridview? 1 reply

i have scenario in have show info of each table field horizontally.

id 1 2 3 4 5 name 'ahmad' 'umar' 'nadeem' 'raza' 'saquib' city 'new york' 'paris' 'london' 'new york' 'london'

can tell me how can done in asp.net c#?

something that:

class programme { static void main(string[] args) { humandto humandto = new humandto(); list<human> humans = new list<human>(); humans.add(new human(){city = "london", id = 1}); humans.add(new human() { city = "london2", id = 2 }); humans.add(new human() { city = "london3", id = 3 }); humans.add(new human() { city = "london4", id = 4 }); humans.foreach(e => humandto.add(e.city, e.id)); } } public class human { public int32 id { get; set; } public string city { get; set; } } public class humandto { public list<int32> ids { get; set; } public list<string> cities { get; set; } public humandto() { ids = new list<int>(); cities = new list<string>(); } public void add(string city, int32 id) { ids.add(id); cities.add(city); } }

c# asp.net sql

tortoisehg - How to develop features with Mercurial correctly? -



tortoisehg - How to develop features with Mercurial correctly? -

we 2 developers , want utilize mercurial in our little project. both in touch mercurial first time. openend bitbucket business relationship our repository. generated test project skeleton , pushed on repository. workmate clone repository , commited testing. want force on repository server.we got that:

i cant merge 2 branches, becouse there no head revision. can update master branch , got that:

is there way merge 2 branches? best practise manage somethink (eg. develop feature)? maybe workmate need clone , open new named branch?

bottom line mercurial - merge locally. in repository , force parent repository.

your bitbucket repository container. maintain master repository , work locally.

also, @boas suggested, @ dvcs u , hginit. both great starters (and advanced users) , sort dvcs.

mercurial tortoisehg

iphone - iOS Quartz 2D Graphics Filled Irregular Shapes Blurry -



iphone - iOS Quartz 2D Graphics Filled Irregular Shapes Blurry -

i'm drawing irregular shapes using core graphics on retina display. creating uibezierpath 5 10 random points. in drawrect stroke path , fill using solid reddish colour.

my problem diagonal lines in drawing doesn't appear sharp.

i have tried anti aliasing if makes appear worse. have experimented different line widths, not stroking, not filling, can not seem sharp diagonal line.

for comparing created similar shape in photoshop (using similar size) , saved png. if display png on ios looks much sharper.

what can create shape create in code sharp?

make sure cgpoint's rounded nearest integer value.

iphone ios ipad core-graphics

c# - ServiceStack DELETE request is default object, POST works fine -



c# - ServiceStack DELETE request is default object, POST works fine -

i have dto coming javascript client. when seek send deletefromservice request object empty (looks new-ed up). if alter method posttoservice request object populated properly.

i using 3.9 api. @ loss here.

service:

public object post(order request) { homecoming _orderrepository.insertorder(request); } public object delete(order request) { _orderrepository.deleteorder(request.uuid); homecoming true; }

js:

//fails serviceclient.deletefromservice("order", order, function () { }, deletefailed); //works serviceclient.posttoservice("order", order, function () { }, deletefailed);

update:

i found issue in servicestack source code. treating delete , creating request object instead of body, post.

if (httpmethod == httpmethods.get || httpmethod == httpmethods.delete || httpmethod == httpmethods.options) { seek { homecoming keyvaluedatacontractdeserializer.instance.parse(querystring, operationtype); } }

the problem doing this, servicestack js client creates delete request using same logic post, stuffing info send body (technically jquery xhr data prop), meaning there no way server message client sending.

am reading right? js client's delete broken?

i rewrote servicestack.js client adding next line in p.send function before options var initialization...

if (ajaxoptions.type === "delete") { requesturl = requesturl + "?" + decodeuricomponent($.param(request[webmethod])); }

c# servicestack

mysql - LOAD DATA LOCAL INFILE with PHP no data imported -



mysql - LOAD DATA LOCAL INFILE with PHP no data imported -

what seek accomplish export info excel 2013 , upload info remote server. info kept in excel , refreshed weekly. utilize mysql 5.x , php 5.3.x , work on windows 7 scheme development environment using wamp. did lot of research in net not solve problem.

this table:

$query = "create table if not exists `t0` ( `id` int not null auto_increment , `fromport` char(10) not null , `kabatas` int null , `eminonu` int null , `bostanci` int null , `maltepe` int null , `kartal` int null , `buyukada` int null , `heybeliada` int null , `burgazada` int null , `kinaliada` int null , `sedefadasi` int null , `fromtime` char(10) null , `fromtype` varchar(50) null , `company` varchar(50) null , `duration` char(10) null , `price` float null , primary key (`id`) ) ;";

this php part load data:

$query = 'load info local infile "c:/transportation/' . $filename . '.txt" table ' . $filename . ' lines terminated "\r\n" ignore 1 lines;'; $result = mysqli_query($db, $query);

the test info is:

no fromport kabatas eminonu bostanci maltepe kartal buyukada heybeliada burgazada kinaliada sedefadasi fromtime fromtype company duration

price kabataÅž 1 08:30 vapur Ä°do 01:30 5.00 tl kabataÅž 1 09:30 vapur Ä°do 01:30 5.00 tl kabataÅž 1 13:00 vapur Ä°do 01:30 5.00 tl kabataÅž 1 15:00 vapur Ä°do 01:30 5.00 tl kabataÅž 1 19:00 vapur Ä°do 01:30 5.00 tl

now:

there no errors there no info in table result (checking mysql workbench) lines , cr+lf, info delimited tab (checked notepad++)

any thoughts? give thanks in advance

php mysql

GWT 2.5 Application Deployment in Tomcat? -



GWT 2.5 Application Deployment in Tomcat? -

i using gwt 2.5. have application using gwt-rpc. have compiled project , create war file using ant-script. when deploy project on tomcat loads doesn't show control. simple blank html page. here files. module

class="lang-xml prettyprint-override"><?xml version="1.0" encoding="utf-8"?> <!-- when updating version of gwt, should update dtd reference, app can take advantage of latest gwt module capabilities. --> <!doctype module public "-//google inc.//dtd google web toolkit 2.5.0//en" "http://google-web-toolkit.googlecode.com/svn/tags/2.5.0/distro-source/core/src/gwt-module.dtd"> <module rename-to='interviewscheduler'> <!-- inherit core web toolkit stuff. --> <inherits name='com.google.gwt.user.user'/> <!-- inherit default gwt style sheet. can alter --> <!-- theme of gwt application uncommenting --> <!-- 1 of next lines. --> <inherits name='com.google.gwt.user.theme.clean.clean'/> <!-- <inherits name='com.google.gwt.user.theme.standard.standard'/> --> <!-- <inherits name='com.google.gwt.user.theme.chrome.chrome'/> --> <!-- <inherits name='com.google.gwt.user.theme.dark.dark'/> --> <!-- other module inherits --> <inherits name="com.smartgwt.smartgwt"/> <!-- specify app entry point class. --> <entry-point class='interviewscheduler.client.interviewscheduler'/> <!-- specify paths translatable code --> <source path='client'/> <source path='shared'/> </module>

remote service

class="lang-java prettyprint-override">package interviewscheduler.client; import interviewscheduler.shared.interview; import interviewscheduler.shared.teacher; import java.util.linkedhashmap; import java.util.list; import com.google.gwt.user.client.rpc.remoteservice; import com.google.gwt.user.client.rpc.remoteservicerelativepath; @remoteservicerelativepath("interviewscheduler") public interface interviewschedulerservice extends remoteservice{ boolean loadstudentdata() throws illegalargumentexception; boolean loadparentdata() throws illegalargumentexception; boolean loadteacherdata() throws illegalargumentexception; boolean loadclassdata() throws illegalargumentexception; boolean loadclassmembershipdata() throws illegalargumentexception; boolean loadroomdata() throws illegalargumentexception; boolean loadsessiondata() throws illegalargumentexception; boolean loadinterviewdata() throws illegalargumentexception; linkedhashmap<string, string> getstudentnames() throws illegalargumentexception; string getparentname(string studentkey) throws illegalargumentexception; list<teacher> getavailableteachers(string studentkey) throws illegalargumentexception; list<teacher> getrequestedteachers(string studentkey) throws illegalargumentexception; list<interview> getinterviewbystudent(string studentkey) throws illegalargumentexception; list<interview> getinterviewbyteacher(string teachercode) throws illegalargumentexception; list<object> getinterviewsforgrid(list<interview> list) throws illegalargumentexception; string addinterview(interview obj) throws illegalargumentexception; string removeinterview(string studentid, string teacherid) throws illegalargumentexception; }

web.xml

class="lang-xml prettyprint-override"><?xml version="1.0" encoding="utf-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"> <!-- servlets --> <servlet> <servlet-name>interviewschedulerservlet</servlet-name> <servlet-class>interviewscheduler.server.interviewschedulerserviceimpl</servlet-class> </servlet> <servlet-mapping> <servlet-name>interviewschedulerservlet</servlet-name> <url-pattern>/interviewscheduler/interviewscheduler</url-pattern> </servlet-mapping> <!-- default page serve --> <welcome-file-list> <welcome-file>interviewscheduler.html</welcome-file> </welcome-file-list> </web-app>

any ideas doing wrong.? urgent.

class="lang-java prettyprint-override">package interviewscheduler.client; import com.google.gwt.core.client.entrypoint; import com.google.gwt.core.client.gwt; import com.google.gwt.user.client.window; import com.google.gwt.user.client.rpc.asynccallback; import com.google.gwt.user.client.ui.rootlayoutpanel; import com.smartgwt.client.widgets.layout.vlayout; /** * entry point classes define <code>onmoduleload()</code>. */ public class interviewscheduler implements entrypoint { /** * entry point method. */ private interviewschedulerserviceasync remoteobject=gwt.create(interviewschedulerservice.class); private vlayout wrapper=new vlayout(); private vlayout headerarea=new header(); private vlayout contentarea=new contentarea(); public void onmoduleload() { window.enablescrolling(true); window.setmargin("0px"); remoteobject.loadstudentdata(new asynccallback<boolean>() { @override public void onsuccess(boolean result) { rootlayoutpanel.get().add(drawwrapper()); } @override public void onfailure(throwable caught) { system.out.println("failed*****************"); } }); } /** * initialize wrapper of web site holds other content------main container */ public vlayout drawwrapper(){ wrapper.setwidth100(); wrapper.setheight100(); wrapper.setmargin(0); wrapper.addmember(drawheaderarea()); wrapper.addmember(drawcontentarea()); homecoming wrapper; } /** * initialize header area of web site contains logo title , logout button */ public vlayout drawheaderarea(){ headerarea.redraw(); homecoming headerarea; } /** * initialize content area of web site holds main tabset */ public vlayout drawcontentarea(){ contentarea.redraw(); homecoming contentarea; } }

you have show info somehow in application. you're doing right calling bunch of services. it's quite confusing. should of in 1 phone call server. save lot of round trips , save having failed calls.

gwt tomcat deployment gwt-rpc

pointers - inout-parameter - replace one const-handle with another -



pointers - inout-parameter - replace one const-handle with another -

in object, have array of const-handles object of specific class. in method, may want homecoming 1 of handles inout-parameter. here simplified example:

class {} class b { const(a) a[]; this() { = [new a(), new a(), new a()]; } void assign_const(const(a)* value) const { // *value = a[0]; // fails with: error: cannot modify const look *value } } void main() { const(a) a; b b = new b(); b.assign_const(&a); assert(a == b.a[0]); // fails .. }

i not want remove const in original array. class b meant kind of view onto collection constant a-items. i'm new d coming c++. have messed const-correctness in d-way? i've tried several ways work have no clue how right.

how right way perform lookup without "evil" casting?

casting away const , modifying element undefined behavior in d. don't it. 1 time const, it's const. if element of array const, can't changed. so, if have const(a)[], can append elements array (since it's elements const, not array itself), can't alter of elements in array. it's same immutable. instance, string alias immutable(char)[], why can append string, can't alter of elements.

if want array of const objects can alter elements in array, need level of indirection. in case of structs, utilize pointer:

const(s)*[] arr;

but won't work classes, because if c class, c* points reference class object, not object itself. classes, need do

rebindable!(const c) arr;

rebindable in std.typecons.

pointers casting d const-correctness const-cast

css - Tooltip arrow disappears when span has overflow-y : auto -



css - Tooltip arrow disappears when span has overflow-y : auto -

i have tooltip that's based on span load content. content may have varying size have set max-height , max-width span , want able scroll when content exceeds dimensions.

the problem arrow disappears whenever set overflow:scroll;. there workaraound issue?

here's code:

#tooltip { position: absolute; max-height: 300px; max-width:300px; line-height: 20px; overflow: scroll; /*adding makes arrow disappear*/ padding: 10px; font-size: 14px; text-align: left; color: #fff; background: #2e31b1; border: 4px solid #2e31b1; border-radius: 5px; text-shadow: rgba(0, 0, 0, 0.0980392) 1px 1px 1px; box-shadow: rgba(0, 0, 0, 0.0980392) 1px 1px 2px 0px; } #tooltip:after { content: ''; position: absolute; width: 0; height: 0; border-width: 10px; border-style: solid; border-color: transparent #2e31b1 transparent transparent; top: 10px; left: -24px; }

and tooltip contain this:

<span id="tooltip"> <div> info</div> <div> info</div> <div> info</div> <div> longer max-width info</div> //more max-height pixels worth of divs <div> info</div> </span>

i'm not sure cleanest solution, wrap content div so: html

<div id="tooltip"> <div id="content"> <div> info</div> <div> info</div> <div> info</div> <div> longer max-width info</div> <div> info</div> <div> info</div> <div> info</div> </div> </div>

css 

#tooltip { position: absolute; } #content { font-size: 14px; color: #fff; max-height: 100px; max-width:300px; line-height: 20px; overflow: scroll; background: #2e31b1; padding: 10px; border: 4px solid #2e31b1; border-radius: 5px; text-shadow: rgba(0, 0, 0, 0.0980392) 1px 1px 1px; box-shadow: rgba(0, 0, 0, 0.0980392) 1px 1px 2px } #tooltip:after { content: ''; position: absolute; width: 5px; height: 0; border-width: 10px; border-style: solid; border-color: transparent #2e31b1 transparent transparent; z-index:999; top: 10px; left: -24px; }

jsbin: http://jsbin.com/ukaxof/1/edit

css tooltip

javascript - Markers do not show up in googlemap - strange error -



javascript - Markers do not show up in googlemap - strange error -

i trying allow markers show in styled googlemap, using google api.

if seek way:

function initialize() { var mapoptions = { zoom: 8, center: new google.maps.latlng(51.49079, -0.10746), maptypeid: google.maps.maptypeid.roadmap }; var map = new gmaps({ div: "#map1", lat: 41.895465, lng: 12.482324, zoom: 1, zoomcontrol : true, zoomcontrolopt: { style : "small", position: "top_left" }, pancontrol : true, streetviewcontrol : false, maptypecontrol: false, overviewmapcontrol: false }); var styles = [ { featuretype: "road", stylers: [ { "hue": "#ff0000" }, { "lightness": -11 }, { "saturation": -5 } ] }, { featuretype: "road", stylers: [ { "saturation": -26 } ] } ]; map.addstyle({ styledmapname:"styled map", styles: styles, maptypeid: "map_style" }); map.setstyle("map_style"); // add together 5 markers map @ random locations var southwest = new google.maps.latlng(-31.203405, 125.244141); var northeast = new google.maps.latlng(-25.363882, 131.044922); //var bounds = new google.maps.latlngbounds(southwest, northeast); //map.fitbounds(bounds); var cities = [ { name: 'london', position: new google.maps.latlng(51.49079,-0.10746), info: 'bewohner: 7,556,900' }, { name: 'paris', position: new google.maps.latlng(48.856667,2.350987), info: 'bewohner: 2,193,031' }, { name: 'berlin', position: new google.maps.latlng(52.523405,13.4114), info: 'bewohner: 3,439,100' } ]; cities.foreach(function(element, index, array) { var marker = new google.maps.marker({ position: element.position, map: map[0], title: element.name }); var infowindow = new google.maps.infowindow({ content: element.info }); google.maps.event.addlistener(marker, 'click', function() { infowindow.open(map, marker); }); }); } google.maps.event.adddomlistener(window, 'load', initialize);

i no errors in firebug, no markers show up.

if alter this:

var marker = new google.maps.marker({ position: element.position, map: map[0],

to

map: map,

i error message, there invalid value property map.

where error in code?

thank you!

instead of gmaps utilize google.maps.map creating maps seek link. may help you.

https://developers.google.com/maps/documentation/javascript/overlays?hl=en#markers

edited code

var marker; var map; function initialize() { var mapoptions = { zoom: 4, center: new google.maps.latlng(51.49079, -0.10746), maptypeid: google.maps.maptypeid.roadmap }; map = new google.maps.map(document.getelementbyid('map_canvas'), mapoptions); var styles = [ { featuretype: "road", stylers: [ { "hue": "#ff0000" }, { "lightness": -11 }, { "saturation": -5 } ] }, { featuretype: "road", stylers: [ { "saturation": -26 } ] } ]; map.setoptions({styles: styles}); var cities = [ { name: 'london', position: new google.maps.latlng(51.49079,-0.10746), info: 'bewohner: 7,556,900' }, { name: 'paris', position: new google.maps.latlng(48.856667,2.350987), info: 'bewohner: 2,193,031' }, { name: 'berlin', position: new google.maps.latlng(52.523405,13.4114), info: 'bewohner: 3,439,100' } ]; for(var i=0;i<cities.length;i++) { var element=cities[i]; var marker = new google.maps.marker({ position: element.position, map: map, title: element.name }); var infowindow = new google.maps.infowindow({ content: element.info }); google.maps.event.addlistener(marker, 'click', function() { infowindow.open(map, marker); }); } }

javascript google-maps maps google-api

assembly - MC68k assembler address syntax -



assembly - MC68k assembler address syntax -

i'm trying write programme take 8-bit value , write d0. masked 4-bit value. number supposed access number in a0 , write d1.

this number sent output.

this how i'm going @ it:

in_port equ $fffff011 out_port equ $fffff019 mask equ $0f org $4000 start: move.b in_port,d0 andi.b #mask,d0 move.b (0,a0,d0),d1 * problem area move.b d1,out_port jmp start org $5000 segcodes: dc.b $77,$22,$5b,$6b dc.b $2e,$6d,$7d,$23 dc.b $7f,$2f,$dd

my problem seems syntax around comment. nil written d1 , nil sent output.

i had forgotten add together address next command:

movea.l #$5000,a0

this writes destination of address can accessed correctly, think. please right me if i'm wrong.

assembly 68000

spring - Mule 3.3 ignore-resource-not-found -



spring - Mule 3.3 ignore-resource-not-found -

i'm using mule studio 1.3.2, corresponds mule 3.3 believe.

i'm using property-placeholder element. wanted utilize technique described here of having optional override file. however, ignore-resource-not-found attribute beingness flagged error in mule studio: attribute ignore-resource-not-found not defined valid property of property-placeholder

<context:property-placeholder location="classpath:config.properties" ignore-resource-not-found="true" />

is broken or doing silly?

mule 3.3 uses spring context 3.1 schema

which supports ignore-resource-not-found attribute

<xsd:complextype name="propertyplaceholder"> <xsd:attribute name="location" type="xsd:string">...</xsd:attribute> <xsd:attribute name="properties-ref" type="xsd:string">...</xsd:attribute> <xsd:attribute name="file-encoding" type="xsd:string">...</xsd:attribute> <xsd:attribute name="order" type="xsd:integer">...</xsd:attribute> <xsd:attribute name="ignore-resource-not-found" type="xsd:boolean" default="false"> <xsd:annotation> <xsd:documentation><![cdata[specifies if failure find property resource location should ignored. default "false", meaning if there no file in location specified exception raised @ runtime.]]> </xsd:documentation> </xsd:annotation> </xsd:attribute> <xsd:attribute name="ignore-unresolvable" type="xsd:boolean" default="false">... </xsd:attribute> <xsd:attribute name="local-override" type="xsd:boolean" default="false">...</xsd:attribute> </xsd:complextype>

so, you're doing right thing

spring properties mule

jqplot - icefaces barchart shows bar stretched till end of x axis horizontally if only 1 bar is there -



jqplot - icefaces barchart shows bar stretched till end of x axis horizontally if only 1 bar is there -

i using icefaces 3.2. have ace:chart barchart . in simple words if have 1 bar shown in bar chart , bar @ runtime gets stretched till end of x axis.

if have 1 bar shown should show 1 slim bar , not thick bar stretches till end of x axis - how can accomplish this.

jqplot icefaces-3

passwords - How to get title of cuurently active window(parent and child) in java -



passwords - How to get title of cuurently active window(parent and child) in java -

i developing passpro application in want need title of active window adobe reader, ms word,excel,access etc. application having password protection when have clicked on particular application "enter password" kid window gets opened. want kid window title. developing appliaction automatically detects passwords access db when opened password protected file application(like access,word,pdf or ppt).

java passwords window

A Way To Simplify this JavaScript File? jQuery show/hide? -



A Way To Simplify this JavaScript File? jQuery show/hide? -

i have 4 divs, , 4 corresponding buttons. when click button1, shows div 1 , hides others. , and forth. instead of having list of divs hide, can have 'hide other divs' sort of string? not hide every div on page, hide every #div(number).

$(document).ready(function() { var h1 = $("#div56").height(); var h2 = $("#div54").height(); var h3 = $("#div47").height(); var h4 = $("#div45").height(); $("#div56,#div54,#div47,#div45").height(… h2, h3, h4)); $("#div54,#div47,#div45").hide(); }); $("#lnk56").live('click', function() { $("#div56").show(); $("#div54,#div47,#div45").hide(); }); $("#lnk54").live('click', function() { $("#div54").show(); $("#div56,#div47,#div45").hide(); }); $("#lnk47").live('click', function() { $("#div47").show(); $("#div56,#div54,#div45").hide(); }); $("#lnk45").live('click', function() { $("#div45").show(); $("#div56,#div54,#div47").hide(); });

this corresponding html/php:

<div class="grid_5"> <?php query_posts( 'post_type=credits&showposts=99999'); ?> <?php if (have_posts()) : while (have_posts()) : the_post(); ?> <div class="post"> <div class="buttons"> <a id="lnk<?php the_id(); ?>" href="#"><h5><?php the_title(); ?></h5></a> </div><!--/buttons--> <?php wp_link_pages(array('before' => 'pages: ', 'next_or_number' => 'number')); ?> </div> <?php endwhile; endif; ?> </div><!--/grid_5--> <div class="grid_7"> <div class="scrollbox"> <div id="divparent"> <?php query_posts( 'post_type=credits'); ?> <?php if (have_posts()) : while (have_posts()) : the_post(); ?> <div class="info" id="<?php the_id(); ?>"> <?php the_content(); ?> </div> <?php endwhile; endif; ?> </div><!--/divparent--> </div> </div><!--/grid_7-->

you can hide using class , create dynamic, can utilize data-* attributes retrieve right id button , show corresponding div. see jsfiddle: http://jsfiddle.net/v9zzy/

$(document).on("click", "button", function(){ var id = $(this).attr('data-btn-id'); $(".mydivs").hide(); $("#div" + id).show(); }); <div id="div1" class="mydivs">hello 1</div> <button id="btn1" data-btn-id="1">btn 1</button> <div id="div2" class="mydivs">hello 2</div> <button id="btn2" data-btn-id="2">btn 2</button> <div id="div3" class="mydivs">hello 3</div> <button id="btn3" data-btn-id="3">btn 3</button> ...

jquery hide show

PHP Can't get value textbox -



PHP Can't get value textbox -

i have table.

<tableid="mytable" > <tr class='row'> <td>name</td> <td><input type="textbox" name="txtname" /></td> </tr> </table>

i used jquery add together new row

var = $(".row").html(); $("#mytable > tbody:first").append("<tr class='row'>"+a+"</tr>");

this code php

$_request['txtname'];

i can't values textbox when create new rows. please help me

assuming html right on server, reason can't values new rows have same variable name. create name of input array.

<table id="mytable" > <tr class='row'> <td>name</td> <td><input type="textbox" name="txtname[]"></td> </tr> </table>

now names in array $_request['txtname']

also, don't utilize $_request. utilize $_post, $_get, $_cookie, etc. there security reasons.

php textbox get

WPF crash with large image. HRESULT 0x88980406 -



WPF crash with large image. HRESULT 0x88980406 -

i have usercontrol wide 60 x 50,000 displaying waveform of sound file. several users reporting crash hresult of 0x88980406 , googles isn't giving useful info it. app using .net 4.0.

if (maincanvas.children.count > 0) maincanvas.children.clear(); (int = 0; < currentsong.waveformlines.length; i++) { maincanvas.children.add(currentsong.waveformlines[i]); } rendertargetbitmap renderbitmap = new rendertargetbitmap((int)width, (int)height, 96d, 96d, pixelformats.pbgra32); // needed otherwise image output black maincanvas.measure(new size((int)width, (int)height)); maincanvas.arrange(new rect(new size((int)width, (int)height))); renderbitmap.render(maincanvas); image img = new image(); img.source = renderbitmap; if (maincanvas.children.count > 0) maincanvas.children.clear(); maincanvas.children.add(img);

what i'm doing drawing sample values line segments , adding them array , set them on canvas. create bitmap canvas, delete line segments , add together bitmap source of image command on canvas.

it crashes in maincanvas.children.add(img);

wpf image canvas

perl - Hash value is not re-initialized when loop is terminated with 'last' keyword -



perl - Hash value is not re-initialized when loop is terminated with 'last' keyword -

consider next nested loops:

my %deleted_documents_names = map { $_ => 1 } $self->{manual}->get_deleted_documents(); while($sth->fetch){ ..... ..... ..... while(my ($key, $value) = each(%deleted_documents_names)){ { if($document_name eq $key){ $del_status=1; last; } } if($del_status==1){next;} ..... ..... ..... ..... }

now, take sample case 3 values (a,b,c) compared against 2 values (b,c).

first scan: compared b compared c sec scan: b compared b loop terminated. 3rd scan: c compared c.

in case, c should compared first b, beingness first value, comparing skipped, , scans next element after 1 found equal. if remove lastly termination status , allow loop run total number of scans, works fine, need find out why in case, $key refers next compared value , not first value 1 time loop restarted after getting terminated lastly keyword.

any help appreciated.

use

keys %deleted_documents_names ; # reset "each" iterator.

see keys.

but, why iterating on hash? why don't just

if (exists $deleted_documents_names{$document_name}) {

perl perl-data-structures

.htaccess - htaccess - redirect domain.com/index.php?a=b to /b -



.htaccess - htaccess - redirect domain.com/index.php?a=b to /b -

i redirect url http://domain.com/index.php?section=abc http://domain.com/abc - without trailing slash. , @ same time prevent direct folder access

the sec thing works fine next code:

rewriteengine on rewriterule ^([a-za-z0-9_-]+)/$ / [r=301]

but first thing doesn't work correctly when try:

rewriterule ^([^/]*)/$ /index.php?section=$1 [l]

i glad if help me "little" problem. way - perchance apply 2 functions , add together 3rd rewrite rule redirect /abc/ /abc ...?

thanks :)

to send traffic index.php:

rewriteengine on rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^(.*)$ /index.php?section=$1 [l]

this send requests files don't exist on filesystem index.php. way images, css, etc not redirected. means if have static file need serve can putting on server.

i'm not exclusively sure mean wanting disable direct folder access. mean people able see files in folder navigating them? if that's case, you'll want disable indexes.

options -indexes

you should create sure you've got directoryindex setting includes index.php. common:

directoryindex index.php index.html index.htm

if of files exist in folder that's requested without filename, rendered.

take @ apache manual more info these options:

http://httpd.apache.org/docs/current/mod/core.html#options - http://httpd.apache.org/docs/current/mod/mod_dir.html#directoryindex

.htaccess mod-rewrite redirect

r - apply function to group values while plotting (ggplot) -



r - apply function to group values while plotting (ggplot) -

just wondering if possible manipulable y-axis of ggplot geom_bar

for example:

library(plyr) df1 <- data.frame(a=c(5,5,10,10,10)) df2 <- ddply(df1,.(a),sum) ggplot(df2,aes(a,v1)) + geom_bar(stat="identity")

instead of aggregating df1, possible produce plot straight in ggplot?

you can using stat_summary:

ggplot(df1, aes(a, a)) + stat_summary(fun.y=sum, geom="bar")

r ggplot2

Selecting what elements from an RSS feed appear in infobox on map -



Selecting what elements from an RSS feed appear in infobox on map -

i have georss feed flickr set showing on map kml layer , images appear intended in infoboxes.

above image text 'flickr username posted image', text content element of feed item.

i remove , i'm trying find simple way of showing elements feed want in infoboxes.

you must supress default infowindows , create own.

how works described couple of hours ago here (the question there weatherlayer, workflow same).

the contents of cklicked item stored in featuredata-property of kmlmouseevent-object, passed argument click-callback. must parse these info , create desired content infowindow.

google-maps-api-3

eclipse - Cannot copy and paste older version of code in Subclipse? -



eclipse - Cannot copy and paste older version of code in Subclipse? -

in eclipse svn plugin subclipse. when right click on file , go

team --> show history

then select version of file want view,. commands select (ctril-a) , re-create (ctrl-c) , paste (ctril+v) not work.

is sort of protection feature stop people using older versions of code?

my latest version of code badly broken, want replace contents of older file version?

how do that?

thanks

right click on file , take 'replace with->revision or url' take working version , you're done.

eclipse svn subclipse

c - Calling execve bash on bash scripts can't find arguments -



c - Calling execve bash on bash scripts can't find arguments -

i have 2 (ubuntu linux) bash scripts take input arguments. need run simultaneously. tried execve arguments e.g.

char *argv[10] = { "/mnt/hgfs/f/working/script.sh", "file1", "file2", null };

execve(argv[0], argv, null)

but bash script can't seem find arguments @ e.g. $0, $1, $2.

printf "gcc -c ./%s.c -o ./%s.o\n" $1 $1; gcc -c ./$1.c -o ./$1.o -g exit 0;

output gcc -c ./main.c -o ./main.o , lot of errors /usr/include/libio.h:53:21: error: stdarg.h: no such file or directory

what's missing?

does script start hashbang line? think that's must, like:

#!/bin/bash

for example, see next c program:

#include <stdio.h> #include <unistd.h> char *argv[10] = { "./qq.sh", "file1", null }; int main (void) { int rc = execve (argv[0], argv, null); printf ("rc = %d\n", rc); homecoming 0; }

when compiled , run next qq.sh file, outputs rc = -1:

echo $1

when alter file to:

#!/bin/bash echo $1

it outputs:

file1

as expected.

the other thing need watch out using these vmware shared folders, evidenced /mnt/hgfs. if file created windows-type editor, may have "dos" line endings of carriage-return/line-feed - may causing problems execution of scripts.

you can check running:

od -xcb /mnt/hgfs/f/working/script.sh

and seeing if \r characters appear.

for example, if utilize shell script hashbang line in (but appen carriage homecoming line), also rc = -1 output, meaning couldn't find shell.

and, now, based on edits, script has no problem interpreting arguments @ all. fact outputs:

gcc -c ./main.c -o ./main.o

is proof positive of since it's seeing $1 main.

the problem have compiler is working cannot find strdarg.h included libio.h file - has nil whether bash can see arguments.

my suggestion seek , compile manually command , see if same errors. if so, it's problem you're trying compile rather bash or exec issue.

if compile okay, may because of destruction of environment variables in execve call.

c linux bash

android - How does findViewById initialise a view -



android - How does findViewById initialise a view -

i wrote reply confused findviewbyid , realised have gap in understanding. question knowledge , curiosity only.

consider this:

button = (button)findviewbyid(r.id.button);

findviewbyid returns instance of view, cast target class. far.

to setup view, findviewbyid constructs attributeset parameters in associated xml declaration passes constructor of view.

we cast view instance button.

how attributeset passed in turn button constructor?

[edit]

so confused 1 :). whole point when layout inflated, view hierarchy contains instance of view descendant class. findviewbyid returns reference it. obvious when think - doh..

findviewbyid nothing. looks through view hierarchy , returns reference view requested viewid. view created , exists. if not phone call findviewbyid view nil changes.

views inflated layoutinflator. when phone call setcontentview xml layout parsed , view hierarchy created.

attributes passed button's constructor layoutinflater. check layoutinflator source code.

android

nginx - Serving a Plone Subfolder on an Existing Website -



nginx - Serving a Plone Subfolder on an Existing Website -

i'm trying serve subfolder in plone site part of existing site. when features stop working e.g. @@overview-controlpanel view inaccessible.

for example:

the existing domain example.com. existing site served there. goal serve localhost:8080/plone/subfolder on url example.com/mysite using reverse proxy.

from how understand virtualhostmonster should able next nginx config:

server { hear 80; server_name example.com; client_max_body_size 25m; location /events { proxy_set_header host $host; proxy_set_header x-real-ip $remote_addr; proxy_set_header x-forwarded-for $proxy_add_x_forwarded_for; proxy_pass http://localhost:8080/virtualhostbase/http/example.com/plone/subfolder/virtualhostroot/_vh_mysite/; } }

this works pretty well, except fact cannot access @@overview-controlpanel. 404.

how have form proxy_pass url using virtualhostmonster serve site under example.com/mysite without error?

you can't have both ways; can serve subfolder part of site, things have have access site root.

set separate, private domain access root folder normal site, , access command panel there. command panel views tied plone portal root object, reason.

nginx plone zope

jsf 2 - How to pass the selected object from orderlist and submit on serverside -



jsf 2 - How to pass the selected object from orderlist and submit on serverside -

<h:panelgrid columns="2"> <h:outputtext value="search results list"/> <p:commandbutton value="add user" process="@this" styleclass="btn-primary" style=" margin-bottom: 20px;margin-left: -80px;width:75px;" action="#{testbean.adduser(user)}"/> <p:orderlist styleclass="resultbox" style="color: #263f6a;" var="user" value="#{testbean.contacts}" itemlabel="#{user.firstname}" itemvalue="#{user.firstname}" controlslocation="none"> </p:orderlist> </h:panelgrid>

i working primefaces orderlist, have managed orderlist backend, have select 1 of item orderist , have send server side query.. have posted above code that.. facing problems user object null.. how send selected item orderlist , send across server please explain me process="@this" . using primefaces 3.4.2 , jsf2 websphere8.

thanks in advance

p:orderlist not info component. cannot send info backend that. check this. seek using datatable , displaying value in it. can utilize f:setpropertyactionlistener datatable.

also know @this check link

edit: check primefaces showcase pass info using datatable , this

jsf-2 primefaces

Flash to ASP.NET -



Flash to ASP.NET -

i made flash game when user finishes game clicks button, sends him aspx file (this needed save info db), after saves info reloads swf file.

when user clicks button shows loading % in corner of browser.

what loading progress indicating?

in flash film or effects ..etc on frames. when frame finished film finished. @ lastly frame can phone call function , can whatever want.

asp.net flash

ASP.NET Uploading file over 300KB~ makes browser lose connection -



ASP.NET Uploading file over 300KB~ makes browser lose connection -

i've been running image-uploading site month now. haven't touched script lately , problem occurs never happened before, bigger uploads. when uploading file size exceeds 300 kb area, browser lose connection. lower upload immediatly, nail upload button in no moments you're redirected page of image.

the website address http://img.kfirprods.com/upload.aspx

as web.config, tried these suggestions alter execution time , maxrequestlength none of these helped, both modest sizes , unmodest sizes. default settings requestlength 4mb , user-server connection lost way before that. web.config

<configuration> <system.web> <compilation debug="true" targetframework="4.0"/> <httpruntime requestvalidationmode="2.0" /> <customerrors mode="off"/> <machinekey validationkey="eef33150a048d162d22cb36e1cb9956b148c7a4e6999d0f05b53d416d7a16f83823dd626f501dd3549d3e5dcb473634739d0ad9a07f71560946498c943a7586d" decryptionkey="0e95f75864047eb6322ea7d5246f2c1175d77a1b016f293c3baad000299a3dc8" validation="sha1" decryption="aes" /> </system.web> </configuration>

there others httpruntime settings default settings, should work - don't. however, happens server behaves if it's downwards down user exceeded little size of upload , homecoming after min or two. please, who's bit of expert - seek upload 'heavy' image , see if recognize problem.

put next in web.config file

<configuration> <system.web> <httpruntime maxrequestlength="4096" /> </system.web> </configuration>

by default value 4096 = 4mb. however, on shared hosting individual hosts might configure different value , limits size of file can upload.

further, can/cannot modify these settings depending on permissions given host.

asp.net file upload web-config connection

asp classic - Convert Time to UTC vbScript -



asp classic - Convert Time to UTC vbScript -

i have next function fine @ converting current time utc time.

function toutc(byval ddate) dim oshell : set oshell = createobject("wscript.shell") toutc = dateadd("n", oshell.regread("hkey_local_machine\system\currentcontrolset\control\timezoneinformation\activetimebias"), cdate(ddate)) end function

however, thinking not adequately handle conversion of future or historical dates utc, since function need know offset of server's timezone @ time of date beingness converted, , whether or not during daylight savings time or not.

how can around this?

i using vbscript/classic asp on windows server iis7.5

to clarify, has nil formatting date. converting utc server timezone historical dates. during daylight savings time, offset off 60 minutes if seek convert datetime occurred in standard time)

for example: lets today, 2013-02-19 (non daylight-savings time), want covert timestamp say, 2008-06-05 (during daylight savings period) pdt (my server timezone) utc. using method in function give me value 60 minutes off right value (because current time pst (not pdt), offset wrong historical date).

here solution ended implementing @ suggestion of @aardvark71.

i set in func.asp file:

<script language="javascript" runat="server"> function toutcstring(d) { var ddate = new date(d); homecoming math.round(ddate.gettime() / 1000); }; </script>

it outputs timestamp value. anywhere in classic asp code, can this:

response.write dateadd("s", toutcstring(cdate("11/11/2012 06:25 pm")), "01/01/1970 00:00:00") 'expect 11/11/2012 10:25:00 pm gmt/utc time response.write dateadd("s", toutcstring(cdate("06/11/2012 06:25 pm")), "01/01/1970 00:00:00") 'expect 6/11/2012 9:25:00 pm gmt/utc time

this (i believe) simple, , produces expected values , factors in dst.

asp-classic vbscript utc

c# - Windows Speech Recognition -



c# - Windows Speech Recognition -

is there way, c# code, "launch" windows speech recognition app same way (or similar way) can utilize mcisendstring begin , stop recording microphone, start listening , dictate stop recording?

c# .net

oracle11g - Why do these 2 oracle functions perform differently? -



oracle11g - Why do these 2 oracle functions perform differently? -

i wrote function in oracle convert ip addresses integers. seemed slow. wrote sec function same thing faster. unfortunately ended slower , not know why.

original function;

function get_ip_integer ( ip_in in varchar2 ) homecoming number dot_counter integer; current_dot integer; last_dot integer := 1; current_integer integer := 0; output_integer integer := 0; begin dot_counter in 1..3 loop current_dot := instr(ip_in,'.',last_dot); current_integer := to_number(substr(ip_in,last_dot,current_dot - last_dot)); last_dot := current_dot + 1; case dot_counter when 1 current_integer := current_integer * 16777216; when 2 current_integer := current_integer * 65536; when 3 current_integer := current_integer * 256; end case; output_integer := output_integer + current_integer; current_integer := 0; end loop; current_integer := to_number(substr(ip_in,last_dot)); output_integer := output_integer + current_integer; homecoming output_integer; end get_ip_integer;

it picks apart , works well. thought improve wrote this;

function get_ip_integer1 ( ip_in in varchar2 ) homecoming number octet_counter integer; current_integer integer := 0; output_integer integer := 0; begin octet_counter in 1..4 loop current_integer := to_number(regexp_substr(ip_in,'\w+',1,octet_counter)); current_integer := power(2,24 - ((octet_counter-1)*8)) * current_integer; output_integer := output_integer + current_integer; end loop; homecoming output_integer; end get_ip_integer1;

this works seems run much (about twice long) slower. assume either powerfulness function or regexp_substr pig. hoping more knowledge might point out which, and/or why.

here little piece of knowledge: in oracle 11g, have hierarchical pl/sql profiler. show pl/sql spending time.

oracle oracle11g

vtd xml - VTD-XML creating an XML document -



vtd xml - VTD-XML creating an XML document -

i bit confused on how this, of docs / examples show how read , edit xml docs there doesn't seem clear way of creating xml scratch, rather not have ship programme dummy xml file in order edit one. ideas? thanks.

what instead hard-code empty document this:

byte[] emptydoc = "<?xml version='1.0' encoding='utf-8'?><root></root>".getbytes("utf-8");

and utilize create vtdgen , xmlmodifier, , start adding elements:

vtdgen vg = new vtdgen(); vg.setdoc(emptydoc); vg.parse(true); vtdnav vn = vg.getnav(); xmlmodifier xm = new xmlmodifier(vn); // cursor @ root, update root element name xm.updateelementname("employee"); xm.insertattribute(" id='6'"); xm.insertafterhead("<name>bob smith</name>"); vn = xm.outputandreparse(); // etc...

vtd-xml

slider - Right slide secondary menu in android -



slider - Right slide secondary menu in android -

i got sliding menu lib here, dont no wrong here, in right side slide menu appears blank. here code

// customize slidingmenu slidingmenu sm = getslidingmenu(); sm.setmode(slidingmenu.left_right); sm.setshadowwidthres(r.dimen.shadow_width); sm.setshadowdrawable(r.drawable.shadow); sm.setbehindoffsetres(r.dimen.slidingmenu_offset); sm.setfadedegree(0.35f); //sm.settouchmodeabove(slidingmenu.left_right); getsupportactionbar().setdisplayshowhomeenabled(true); getsupportactionbar().setdisplayhomeasupenabled(true);

here way i'm calling secondarymenu

@override public boolean onoptionsitemselected(menuitem item) { switch (item.getitemid()) { case android.r.id.home: showsecondarymenu(); homecoming true; } homecoming super.onoptionsitemselected(item); } }

here way i'm instantiating fragment.

setcontentview(r.layout.activity_home_frame); getsupportfragmentmanager() .begintransaction() .replace(r.id.home_screen, new mapfragment()) .commit(); getslidingmenu().setsecondarymenu(r.layout.activity_home_frame); getsupportfragmentmanager() .begintransaction() .replace(r.id.home_screen, new mapfragment()) .commit(); // set behind view setbehindcontentview(r.layout.activity_settings_frame); getsupportfragmentmanager() .begintransaction() .replace(r.id.settings_screen, new settingsfragment()) .commit();

my map fragment

public class mapfragment extends sherlockfragment{ public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { homecoming inflater.inflate(r.layout.activity_map, null); } @override public void onsaveinstancestate(bundle outstate) { super.onsaveinstancestate(outstate); } }

settings fragment

public class settingsfragment extends sherlockfragment{ public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { homecoming inflater.inflate(r.layout.activity_settings, null); } @override public void onsaveinstancestate(bundle outstate) { super.onsaveinstancestate(outstate); } }

settings layout

<?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <textview android:layout_width="fill_parent" android:layout_height="fill_parent" android:text="settings view." ></textview> </linearlayout>

map layout

<?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <textview android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="your map " ></textview> </linearlayout>

kindly tell why i'm getting right side menu blank?

it got worked, problem is. instead of this

getslidingmenu().setsecondarymenu(r.layout.activity_home_frame);

i need phone call

getslidingmenu().setsecondarymenu(getlayoutinflater().inflate(r.layout.activity_map, null));

android slider actionbarsherlock

excel - Using wildcards in VBA cells.replace -



excel - Using wildcards in VBA cells.replace -

i'm looking write function in excel add together leading zeroes octets create ip address: e.g in 172.19.1.17 want to alter .19. .019., .1. .001., , .17 @ end .017.

te cells.teplace function not seem take ? wildcard. also, there way can represent 'end of string' i'll able add together leading zeroes lastly octet, .17 in illustration above.

thanks ian

cells.replace what:=".1?.", replacement:=".01?.", lookat:=xlpart, _ searchorder:=xlbyrows, matchcase:=false, searchformat:=false, _ replaceformat:=false

this find "10." "11." "12." etc. replaces them ".01?."

as alternative may utilize formula add together zeros ip parts (it looks terrible, treats separately parts , mix them up):

=rept(0,4-find(".",a1))&left(a1,find(".",a1)-1)&"."& rept(0,4-find("@",substitute(a1,".","@",2))+find(".",a1))&mid(a1,find(".",a1)+1,find("@",substitute(a1,".","@",2))-find(".",a1)-1)&"."& rept(0,4-find("@",substitute(a1,".","@",3))+find("@",substitute(a1,".","@",2)))&mid(a1,find("@",substitute(a1,".","@",2))+1,find("@",substitute(a1,".","@",3))-find("@",substitute(a1,".","@",2))-1)&"."& rept(0,3-len(a1)+find("@",substitute(a1,".","@",3)))&right(a1,len(a1)-find("@",substitute(a1,".","@",3)))

you may paste b1 (assuming ips in column starting a1) regardless line breaks.

sample file: https://www.dropbox.com/s/vun6urvukch9uvv/ipoctets.xlsx

excel ip-address

php - Is it possible to str_replace or preg_replace the output of a javascript call? -



php - Is it possible to str_replace or preg_replace the output of a javascript call? -

this question has reply here:

what difference between client-side , server-side programming? 6 answers

i have page calls content page 3rd party using javascript. need preg_replace or str_replace output purposes of translating few words (ie days of week english language spanish). here illustration of javascript call:

<script language="javascript" src="http://www.example.com/?id=100&amp;site=1&amp;plugin=result_type1&amp;<?= $queryparams ?>"> </script>

the js outputs results html table. possible? don't have more code because wouldn't know how go starting this.

any help appreciated.

presumably script loading injects html elements page. 1 time page has loaded, utilize browser view source see elements these , attributes have.

one way of achieving want str_replace on innerhtml property of element want. trigger event <body onload="doreplace()"> doreplace function write handle str_replace.

i'm assuming don't have command on resource injecting. if do, far improve translation before injection rather live on page. if don't, run risk of changes injected code ruining doreplace function without notice.

otherwise, can seek downloading script , changing suit needs. can utilize customized script on pages need customized output.

php javascript preg-replace str-replace

javascript - /assets 404 on javascript_include_tag -



javascript - /assets 404 on javascript_include_tag -

in view:

<script src="http://code.jquery.com/jquery-1.8.3.js"></script> <script src="http://code.jquery.com/ui/1.10.0/jquery-ui.js"></script> <%= javascript_include_tag "modernizr" %>

inspect element:

<script src="http://code.jquery.com/jquery-1.8.3.js"></script> (error in red):get http://my-server.dev/assets/ 404 (not found) <script src="http://code.jquery.com/ui/1.10.0/jquery-ui.js"></script> <script src="/assets/modernizr.js?body=1" type="text/javascript"></script>

i can utilize stylesheet_link_tag without trouble. why javascript tag getting 404?

it depends on app/assets, lib/assets or vendor/assets are. if in doubt, specify total path browser should in.

ref: http://guides.rubyonrails.org/layouts_and_rendering.html

javascript ruby-on-rails

implode - Imploding in PHP -



implode - Imploding in PHP -

i have array having various numbers:

$array = [1,2,3,4];

i have code extract values , prepend 'ad' them while imploding html attribute:

<div class="ad1 ad2 ad3">

how can that?

loop on array, , whatever have to:

foreach ($array $item) { ... }

in exemple:

$classname = ""; foreach ($array $item) { $classname .= "ad".$item." "; } echo '<div class="'.$classname.'">';

php implode

app store - iAd doesn't appear when the application is approved -



app store - iAd doesn't appear when the application is approved -

apple have approved application, problem application not shows banner.

i have implemented these 3 methods of delegate of adbannerview:

-(void)bannerviewdidloadad:(adbannerview *)banner -(bool)bannerviewactionshouldbegin:(adbannerview *)banner willleaveapplication:(bool)willleave -(void)bannerview:(adbannerview *)banner didfailtoreceiveadwitherror:(nserror *)error

in iphone banner test work , it's visible.

did know what's problem?

thanks all!

ads take time load. ads in game came after 1 day of app beingness on app store. wait little. if still not come after week or so, should contact apple.

app-store iad adbannerview revenue

css - How to remove scroll bar form prettyPhoto lightbox? -



css - How to remove scroll bar form prettyPhoto lightbox? -

how remove scrollbar prittyphoto lightbox in ie7 only? in other browsers works perfectly.

try below ones

body{overflow-x: hidden;}

in case if apply html rather body

html{overflow-x: hidden;}

else

html{ overflow:auto; }

try putting if want separate style sheet others

<!--[if ie 7]> link alternate style sheet or <style> /*css in here*/ </style> <![endif]-->

css

autocomplete - SublimeCodeIntel : could not find Python blob 'gtk' -



autocomplete - SublimeCodeIntel : could not find Python blob 'gtk' -

i'm having troubles using sublimecodeintel python. illustration :

self.window = gtk.window(gtk.window_toplevel) self.window.set_title("mega connector") self.window.connect("delete_event", self.delete_event) self.window.connect("destroy", self.destroy) self.window.set_border_width(10) self.window.

when sublimecodeintel tries find out functions can apply object, returns me : could not find info python blob 'gtk' , same every function i'm trying with. i'm using python2.7 , import gtk. code works fine, autocompletion seems not work. don't know why, explain me why ?

autocomplete sublimetext2

logic - Modifying Quine-McCluskey Algorithm for Different Cost Function -



logic - Modifying Quine-McCluskey Algorithm for Different Cost Function -

the standard cost function quine-mccluskey seems involve minimizing number of , gates. purposes, need minimize number of literals instead of number of , gates (for example, take ab+cd on abcde since has 4 literals instead of 5, though has 1 more , gate). can give me pointers on how different cost function alter algorithm?

algorithm logic computer-science cad computer-science-theory

ruby on rails - Using angularjs with turbolinks -



ruby on rails - Using angularjs with turbolinks -

i trying utilize angularjs framework in app turbolinks. after page alter not initialize new eventlisteners. way create work? in advance!

angularjs vs. turbolinks

turbolinks anguluarjs can both used create web application respond faster, in sense in response user interaction happens on web page without reloading , rerendering whole page.

they differ in next regard:

angularjs helps build rich client-side application, write lot of javascript code runs on client machine. code makes site interactive user. communicates server-side backend, i.e. rails app, using json api.

turbolinks, on other hand, helps to create site interactive without requiring code javascript. allows stick ruby/rails code run on server-side , still, "magically", utilize ajax replace, , hence rerender, parts of page have changed.

where turbolinks strong in allowing utilize powerful ajax mechanism without doing hand , code ruby/rails, there might come stage, application grows, integrate javascript framework such angularjs.

especially in intermedium stage, successively integrate angularjs application, 1 component @ time, can create sense run angular js , turbolinks together.

how utilize angularjs , turbolinks together use callback manually bootstrap angular

in angular code, have line defining application module, this:

# app/assets/javascripts/angular-app.js.coffee # without turbolinks @app = angular.module("yourapplication", ["ngresource"])

this code run when page loaded. since turbolinks replaces part of page , prevents entire page load, have create sure, angular application initialized ("bootstrapped"), after such partial reloads done turbolinks. thus, replace above module declaration next code:

# app/assets/javascripts/angular-app.js.coffee # turbolinks @app = angular.module("yourapplication", ["ngresource"]) $(document).on('ready page:load', -> angular.bootstrap(document, ['yourapplication']) ) don't bootstrap automatically

you see in tutorials how bootstrap angular app automatically using ng-app attribute in html code.

<!-- app/views/layouts/my_layout.html.erb --> <!-- without turbolinks --> <html ng-app="yourapplication"> ...

but using mechanism manual bootstrap shown above cause application bootstrap twice and, therefore, brake application.

thus, remove ng-app attribute:

<!-- app/views/layouts/my_layout.html.erb --> <!-- turbolinks --> <html> ... further reading angularjs bootstrapping: http://docs.angularjs.org/guide/bootstrap railscasts on turbolinks (explains callbacks): http://railscasts.com/episodes/390-turbolinks

ruby-on-rails angularjs turbolinks

html - XSLT: Extracting output content from the section attribute using xsl -



html - XSLT: Extracting output content from the section attribute using xsl -

i have variation of question asked before in regards extracting specific according given input classes , content.

i have illustration solution provided @kirill polishchuk. how implement slight variation 1 particular section.

extracting class section attribute using xsl

i’m using xslt1.0, have outlined possible solution i'm not if best practice. i’m totally confused on how solving problem, advise , help appreciated.

input:

<root> <page number="1" section="arsenal_stadium">arsenal_stadium</page> <page number="2" section="arsenal_stadium">arsenal_stadium</page> <page number="3" section="arsenal_stadium">arsenal_stadium</page> <page number="4" section="arsenal_stadium">arsenal_stadium</page> <page number="5" section="arsenal_stadium">arsenal_stadium</page> <page number="6" section="arsenal_stadium">arsenal_stadium</page> <page number="7" section="arsenal_stadium">arsenal_stadium</page> <page number="8" section="arsenal_crowds">arsenal_crowds</page> <page number="9" section="arsenal_crowds">arsenal_crowds</page> <page number="10" section="arsenal_crowds">arsenal_crowds</page> <page number="11" section="arsenal_crowds">arsenal_crowds</page> <page number="12" section="arsenal_crowds">arsenal_crowds</page> <page number="13" section="arsenal_finances">arsenal_finances</page> <page number="14" section="arsenal_finances">arsenal_finances</page> <page number="15" section="arsenal_finances">arsenal_finances</page> <page number="16" section="arsenal_finances">arsenal_finances</page> <page number="17" section="arsenal_finances">arsenal_finances</page> <page number="18" section="arsenal_finances">arsenal_finances</page> <page number="19" section="arsenal_finances">arsenal_finances</page> <page number="20" section="arsenal_outlook">arsenal_outlook</page> <page number="21" section="arsenal_outlook">arsenal_outlook</page> <page number="22" section="arsenal_outlook">arsenal_outlook</page> <page number="23" section="arsenal_outlook">arsenal_outlook</page> <page number="24" section="arsenal_outlook">arsenal_outlook</page> </root>

output

<table> <tr> <td class="stadium">stadium</td> <td></td> <td class="crowds">crowds</td> <td></td> <td class="finances">finance’s today</td> <td></td> <td class="outlook">outlook</td> <td></td> </tr> <tr> <td>1</td> <td>7</td> <td>8</td> <td>12</td> <td>13</td> <td>19</td> <td>20</td> <td>24</td> </tr> </table>

possible solution

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/xsl/transform"> <xsl:output method="xml" omit-xml-declaration="yes" indent="yes"/> <xsl:key name="k" match="page" use="@section"/> <xsl:template match="/root"> <table> <tr> <xsl:apply-templates select="page[generate-id() = generate-id(key('k', @section))]"/> </tr> <tr> <xsl:apply-templates select="page[generate-id() = generate-id(key('k', @section))]" mode="page"/> </tr> </table> </xsl:template> <xsl:template match="page"> <td class="{substring-after(@section, '_')}"> <xsl:choose> <xsl:when test="contains(@section, '_finances')">finance’s today </xsl:when> <xsl:otherwise> <xsl:value-of select="substring-after(@section, '_')"/>: </xsl:otherwise> </xsl:choose> </td> <td></td> </xsl:template> <xsl:template match="page" mode="page"> <td> <xsl:value-of select="@number"/> </td> <td> <xsl:value-of select="key('k', @section)[last()]/@number"/> </td> </xsl:template> </xsl:stylesheet>

regards jj.

here's more extensible approach:

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/xsl/transform"> <xsl:output method="xml" omit-xml-declaration="yes" indent="yes"/> <xsl:key name="k" match="page" use="@section"/> <xsl:variable name="rename"> <item from="arsenal_finances" to="finance’s today" /> </xsl:variable> <xsl:template match="/root"> <xsl:variable name="uniquesections" select="page[generate-id() = generate-id(key('k', @section))]" /> <table> <tr> <xsl:apply-templates select="$uniquesections"/> </tr> <tr> <xsl:apply-templates select="$uniquesections" mode="page"/> </tr> </table> </xsl:template> <xsl:template match="page"> <xsl:variable name="sectiontrimmed" select="substring-after(@section, '_')" /> <td class="{$sectiontrimmed}"> <xsl:variable name="renameitem" select="document('')//xsl:variable[@name = 'rename'] /item[@from = current()/@section]" /> <xsl:choose> <xsl:when test="$renameitem"> <xsl:value-of select="$renameitem/@to"/> </xsl:when> <xsl:otherwise> <xsl:value-of select="$sectiontrimmed"/> </xsl:otherwise> </xsl:choose> </td> <td></td> </xsl:template> <xsl:template match="page" mode="page"> <td> <xsl:value-of select="@number"/> </td> <td> <xsl:value-of select="key('k', @section)[last()]/@number"/> </td> </xsl:template> </xsl:stylesheet>

here have xsl:variable can list 1 or more item names should renamed other names. if match found, @to value used. if not, substring-after(@section, '_') used. i've used variables capture values of 2 formulas beingness used more 1 time in single template.

html xml xslt xslt-1.0

postsharp - AOP - Injecting a property with a dynamically computed value -



postsharp - AOP - Injecting a property with a dynamically computed value -

(or "using locationinterceptionaspect , iinstancescopedaspect together")

using postsharp i'm trying inject property target class using 'introducemember' , using 'ongetvalue' functionality of locationinterceptionaspect dynamically give value on inspection.

originally thought i'd need 2 separate aspects, 1 field injection , 1 location interception managed combine 2 implementing iinstancescopedaspect interface , inheriting locationinterceptionaspect.

the problem if set breakpoint see property that's been injected, if set breakpoint in ongetvalue method (that gets fired each property on class) can't see it...

here's sample code:

[serializable] class daldecoratorwrapper : locationinterceptionaspect, iinstancescopedaspect { public override void ongetvalue(locationinterceptionargs args) { if (args.locationname == "type") { args.value = "computed value here"; } args.proceedgetvalue(); } [introducemember(overrideaction = memberoverrideaction.overrideorfail)] public string type { get; set; }

i hoping there improve way of doing overriding ongetvalue that's called each getter want target getter of property that's been injected

cheers

aop postsharp

Multiple "Page N of M" in a single VB6 ActiveReport -



Multiple "Page N of M" in a single VB6 ActiveReport -

i have active study generates study of multiple pages. need show page n of m multiple times based on field "coid" nowadays in details section. eg- if there 10 pages(2 coid 1001, 1 coid 1002 , 7 coid 1003) so, want pages "pages 1 of 2", "pages 2 of 2", "pages 1 of 1", "pages 1 of 7", "pages 2 of 7".... "pages 7 of 7".

please help.

i have worked ar version 3.00 on wards. in these achieved , using sub report.

i did quick research on , found before version supports sub reports

how using sub study follow article in link , create parent , child/sub reports. parent study info run sql query grouping coid , pass each coid sub report. have envisage blank parent study detail section in detail section insert sub study control. assign existing study sub study control.

sub study has own issues long maintain parent , sub study communication simple. , create 1 sub study instance object in parent report. utilize same instance pass parameter each row in parent dataset coid.

vb6 activereports

Run time memory of perl script -



Run time memory of perl script -

i having perl script killed automated job whenever high priority process comes script running ~ 300 parallel jobs downloading info , consuming lot of memory. want figure out how much memory takes during run time can inquire more memory before scheduling script or if know using tool portion in code takes more memory, can optimize code it.

regarding op's comment on question, if want minimize memory use, collect , append info 1 row/line @ time. if collect of variable @ once, means need have of in memory @ once.

regarding question itself, may want whether it's possible have perl code run 1 time (rather running 300 separate instances) , fork create individual worker processes. when fork, kid processes share memory parent much more efficiently possible unrelated processes, will, e.g., need have 1 re-create of perl binary in memory rather 300 copies.

perl memory

postgresql - psycopg2 mapping Python : "list of dicts" to Postgres : "array of composite type" for an INSERT statement -



postgresql - psycopg2 mapping Python : "list of dicts" to Postgres : "array of composite type" for an INSERT statement -

postgres version : 9.1.x.

say have next schema:

drop table if exists posts cascade; drop type if exists quotes cascade; create type quotes ( text character varying, is_direct character varying ); create table posts ( body character varying, q quotes[] );

and wish perform next insert, shown in sql, python psycopg2.

insert posts(body,q) values('ninjas rock',array[ row('i agree',true)::quotes, row('i disagree',false)::quotes ]);

what syntax accomplish (without loops , such). sure possible since documentation says "changed in version 2.4.3: added back upwards array of composite types". documentation shows examples of select statements.

note: have list of dicts in client code conceptually map psuedo-schema above.

edit:

hmm must have missed documentation : "adaptation python tuples composite types automatic instead , requires no adapter registration.". figure out array part.

edit 2:

psycopg2's %s placeholder should work when info type passed list(tuple) or list(dict). gotta test out :d

edit3: ok there, dicts dont work in scenario, lists do, , tuples do. however, need cast tuple string representation composite record type.

this :

quote_1 = ("monkeys rock", "false") quote_2 = ("donkeys rock", "true") q_list = [ quote_1, quote_2] print cur.mogrify("insert posts values(%s,%s)", ("animals good", q_list))

creates next string:

insert posts values('animals good',array[('monkeys rock', 'false'), ('donkeys rock', 'true')])

which produces next error :

psycopg2.programmingerror: column "q" of type quotes[] look of type record[]

extending efforts tiny bit, how about:

class="lang-python prettyprint-override">quote_1 = ("monkeys rock", "false") quote_2 = ("donkeys rock", "true") q_list = [ quote_1, quote_2] print cur.mogrify("insert posts values(%s,%s::quotes[])", ("animals good", q_list)) # # added explicit cast quotes[]->^^^^^^^^

explanation:

if run:

class="lang-sql prettyprint-override">insert posts values('animals good', array[ ('monkeys rock', 'false'), ('donkeys rock', 'true') ]);

directly in psql you'll get:

class="lang-none prettyprint-override">regress=# insert posts regress-# values('animals good',array[ regress-# ('monkeys rock', 'false'), regress-# ('donkeys rock', 'true') regress-# ]); error: column "q" of type quotes[] look of type record[] line 1: insert posts values('animals good',array[('monkeys ... ^ hint: need rewrite or cast expression.

sure enough, telling pg anonymous array of type quotes[] trick:

class="lang-none prettyprint-override">regress=# insert posts regress-# values('animals good',array[ regress-# ('monkeys rock', 'false'), regress-# ('donkeys rock', 'true') regress-# ]::quotes[]); insert 0 1 regress=# select * posts; body | q ------------------+-------------------------------------------------------- animals | {"(\"monkeys rock\",false)","(\"donkeys rock\",true)"} (1 row)

python postgresql orm relational-database psycopg2

Python customized Exception class should allow to continue the program execution after it has been raised -



Python customized Exception class should allow to continue the program execution after it has been raised -

i wrote python programm has customized exception class called taexception , works fine. new requirement forces me extend functionaliy. if user sets specific flag (-n) on programme startup programme should not stop execution if taexception raised.

below see how tried implement it. in main() taexception.setnoabort() gets called if flag has been set. rest maybe self-explaining. point is: doesn't work. programme aborts when taexception raised. know why doesn't work, not know how can implement differently. please show me elegant way this?

class taexception(exception): _numofexception = 0 # how has exception been raised? _noabort = false # default abort test run if exception has been raised. def __init__(self, tr_inst, expr, msg): ''' parameters: tr_inst: testreport instance expr: look in error occured. msg: explanation error. ''' if tr_inst != none: if taexception._noabort true: # if abort test run on first exception beingness raised. taexception._numofexception += 1 # or else count exception , go on test run. # status of testreport set "failed" testreportgen. else: tr_inst.genreport([expr, msg], false) # generate testreport , exit. @staticmethod def setnoabort(): ''' sets taexception._noabort true. ''' taexception._noabort = true

when using parameter -n programme should not raise exception instead utilize warning (that won't stop program). can find more info on warning here : http://docs.python.org/2/library/warnings.html#module-warnings

python exception exception-handling python-2.7

python - How to make Regex choose words seperately -



python - How to make Regex choose words seperately -

ok guys have string:

sockcooker!~shaz@rizon-ac7bdf2f.dynamic.dsl.as9105.com !~shaz@ privmsg #rizon :ohai. new here. registered 10 mins ago, have not got email. addy correct. email working fine.

i want regex find !~shaz@ utilize r"!.+@" finds this

!~shaz@rizon-ac7bdf2f.dynamic.dsl.as9105.com !~shaz@

as remember.i want find them seperate ones , replace them letter..any help on 1 , yea if can give me regex tuts python i'd grateful :d

by default, quantifiers greedy in nature in sense, seek match much can. why regex matching till lastly @.

you can utilize reluctant quantifier (add ? after +) stop @ first @:

r"!.+?@"

or can utilize negated character class, automatically stop @ first @:

r"![^@]+"

choose whatever easier understand you.

python regex

google app engine - Channel API and server affinity -



google app engine - Channel API and server affinity -

as gae instances added , removed how channel api work maintain connection between server , client browser. is, single server maintain connection , solely responsible pushing out messages client browser. or server able send info on channel, , if how channel state maintained across servers?

you don't need worry of that.

any server instance can send info channel if know client id, regardless of server created etc. that's it.

plus 1.7.5 release this:

the channel api has ability send channel messages app version or backend regardless of channel created.

so can utilize backends channel api without workarounds.

http://code.google.com/p/googleappengine/wiki/sdkreleasenotes

google-app-engine channel-api

microcontroller - Making a button do something on Arduino TFT touchscreen -



microcontroller - Making a button do something on Arduino TFT touchscreen -

so have arduino mega2560 , tft shield touchscreen. used 1 of examples create 2 buttons display on screen, using drawrect(). how create these 2 boxes when press them? know coordinates these 2 boxes, how create them "sense" touch , transist screen of display? maybe illustration of code great help! thanks.

my current code below: add together necessary parts it.

#include <adafruit_gfx.h> // core graphics library #include <adafruit_tftlcd.h> // hardware-specific library #define lcd_cs a3 // chip select goes analog 3 #define lcd_cd a2 // command/data goes analog 2 #define lcd_wr a1 // lcd write goes analog 1 #define lcd_rd a0 // lcd read goes analog 0 #define lcd_reset a4 // can alternately connect arduino's reset pin #define black 0x0000 #define bluish 0x001f #define reddish 0xf800 #define greenish 0x07e0 #define cyan 0x07ff #define magenta 0xf81f #define yellowish 0xffe0 #define white 0xffff adafruit_tftlcd tft(lcd_cs, lcd_cd, lcd_wr, lcd_rd, lcd_reset); void setup(void) { serial.begin(9600); progmemprintln(pstr("tft lcd")); #ifdef use_adafruit_shield_pinout progmemprintln(pstr("using adafruit 2.8\" tft arduino shield pinout")); #else progmemprintln(pstr("using adafruit 2.8\" tft breakout board pinout")); #endif tft.reset(); uint16_t identifier = tft.readid(); if(identifier == 0x9325) { progmemprintln(pstr("found ili9325 lcd driver")); } else if(identifier == 0x9328) { progmemprintln(pstr("found ili9328 lcd driver")); } else if(identifier == 0x7575) { progmemprintln(pstr("found hx8347g lcd driver")); } else { progmemprint(pstr("unknown lcd driver chip: ")); serial.println(identifier, hex); progmemprintln(pstr("if using adafruit 2.8\" tft arduino shield, line:")); progmemprintln(pstr(" #define use_adafruit_shield_pinout")); progmemprintln(pstr("should appear in library header (adafruit_tft.h).")); progmemprintln(pstr("if using breakout board, should not #defined!")); progmemprintln(pstr("also if using breakout, double-check wiring")); progmemprintln(pstr("matches tutorial.")); return; } tft.begin(identifier); progmemprint(pstr("text ")); serial.println(starttext()); delay(0); progmemprintln(pstr("done!")); } void loop(void) { starttext(); delay(9999999); } unsigned long starttext() { tft.fillscreen(black); unsigned long start = micros(); tft.setcursor(0, 0); tft.println(); tft.println(); tft.settextcolor(green); tft.settextsize(2.8); tft.println("welcome "); tft.println(); tft.settextcolor(white); tft.settextsize(2.5); tft.println(); tft.drawrect(5, 150, 110, 110, yellow); tft.drawrect(130, 150, 110, 110, red); tft.setcursor(155, 170); tft.settextcolor(red); tft.println("off"); tft.fillrect(5, 150, 110, 110, yellow); tft.fillrect(13, 158, 94, 94, black); tft.settextcolor(green); tft.setcursor(20, 170); tft.println("on"); homecoming micros() - start; } // re-create string flash serial port // source string must within pstr() declaration! void progmemprint(const char *str) { char c; while(c = pgm_read_byte(str++)) serial.print(c); } // same above, trailing newline void progmemprintln(const char *str) { progmemprint(str); serial.println(); }

you need touch screen lib

include

inside loop tspoint p = ts.getpoint(); // retrieve point p = ts.getpoint(); serial.print("x = "); serial.print(p.x); serial.print("\ty = "); serial.print(p.y); serial.print("\tpressure = "); serial.println(p.z);

hope helps

arduino microcontroller