[Solved] Can’t use nested variable

[ad_1] To use the variable outside the block you need to declare it outside the block. As the variable has to have a value even if you don’t run the code in the block, you either have to set an initial value: string test = null; if (condition) { test = “success”; } or use … Read more

[Solved] How to select row with same value

[ad_1] You could probably get by with something like this, assuming your table is called ratings: select r.* from ratings r inner join ( select name, rating, max(value) value from ratings group by name, rating having count(distinct sport) > 1 ) q on r.name = q.name and r.rating = q.rating and r.value = q.value There … Read more

[Solved] Convert Type “String” to type “Name”

[ad_1] The API documentation of IBM Notes explains that a Name object can only be obtained from the Session. “To create a new Name object, use createName in Session. ” see this page Session s = NotesFactory.createSession(); Name n = s.getUserNameObject(); [ad_2] solved Convert Type “String” to type “Name”

[Solved] Store rsync error in variable

[ad_1] The line you have put here will just store that command as a string and not run it. rsync_error=”rsync -arzt –ignore-existing –delete –max-delete=1 -e ‘ssh’ [email protected]:$rsync_from_location $rsync_to_location” To capture its output you would need to put it in a $( ) like so. rsync_error=$(rsync -arzt –ignore-existing –delete –max-delete=1 -e ‘ssh’ [email protected]:$rsync_from_location $rsync_to_location) This will … Read more

[Solved] Why is this simple thing giving an error?

[ad_1] Your code divides by zero whenever a and b are 0. That’s not going to work. You need to change your loop to check the values before you try to use them. [ad_2] solved Why is this simple thing giving an error?

[Solved] Map column birthdates in python pandas df to astrology signs

[ad_1] You can apply the zodiac_sign function to the dataframe as – import pandas as pd from io import StringIO # Sample x = StringIO(“””birthdate,answer,YEAR,MONTH-DAY 1970-03-31,5,1970,03-31 1970-05-25,9,1970,05-25 1970-06-05,3,1970,06-05 1970-08-28,2,1970,08-28 “””) df = pd.read_csv(x, sep=’,’) df[‘birthdate’] = pd.to_datetime(df[‘birthdate’]) df[‘zodiac_sign’] = df[‘birthdate’].apply(lambda x: zodiac_sign(x.day, x.strftime(“%B”).lower())) print(df) Output: birthdate answer YEAR MONTH-DAY zodiac_sign 0 1970-03-31 5 1970 03-31 … Read more

[Solved] how to select from this table and add average value and then sort [duplicate]

[ad_1] select * from <your query> order by PERC wich : select * from ( select no, STUD_ID,CLASS,LESSON, AVG(PERC) as PERC,SUM(CNT) as CNT from t_lesson where LESSON=’CHEM’ group by CLASS union all select no,STUD_ID,CLASS,’AVERAGE’ as LESSON, AVG(PERC) as PERC, SUM(CNT) as CNT from t_lesson where LESSON=’CHEM’ group by LESSON ) as sub order by PERC … Read more

[Solved] Issue with IFRAME? [closed]

[ad_1] Do you mean you want to get rid of the frames? Simple solution is to use `style´: <iframe src=”https://stackoverflow.com/questions/11109229/…” style=”border: 0px”></iframe> If your doctype is HTML5, you can also embed your iframe content seamlessly into the DOM (=”transparent” iframe import): <iframe src=”https://stackoverflow.com/questions/11109229/…” seamless=”seamless” style=”border: 0px;”></iframe> I wouldn’t expect all browsers to support that yet … Read more

[Solved] Unique ID for year

[ad_1] The only way to be sure you have a unique Id in your data set is to test for it. $id = uniqid(2012); //returns a 13 character string plus it will append 2012 for 17 characters. $resultSet = //get dataSet from somewhere foreach($resultSet as $row) { if ($row[‘id’] = $id) { //do some stuff … Read more

[Solved] Calculating speed on an android phone [closed]

[ad_1] This is the example For calculating Speed of your android phone using GPS… LocationManager mlocManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE); LocationListener mlocListener = new MyLocationListener(); mlocManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, mlocListener); public class MyLocationListener implements LocationListener { @Override public void onLocationChanged(Location loc) { loc.getLatitude(); loc.getLongitude(); Geocoder gcd = new Geocoder(getApplicationContext(), Locale.getDefault()); try { mAddresses = gcd.getFromLocation(loc.getLatitude(), loc.getLongitude(), 1); … Read more

[Solved] Grep certain files only

[ad_1] If this is for perl code, as your tags imply, then you would typically use grep: my @all = qw( 12345_lrg.jpg 12445_sml.jpg 14445_sml.jpg 12345_lrg.jpg 42345_lrg.jpg ); my @sml = grep /_sml\.jpg$/i, @all; 2 [ad_2] solved Grep certain files only