关于/data/data/<package name>/shared_prefs目录下文件的读取

想要读取一个第三方应用shared_prefs目录下的xml文件内容,转换格式后显示出来,但因为权限问题,不知道该如何实现,手动更改该文件权限rw-rw----为rw-rw-r---后虽然可以实现功能但会导致第三方应用无法正常运行

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
有人知道怎么获取shared_prefs目录下的xml文件,将xml文件名通过ListView展示。
![图片说明](https://img-ask.csdn.net/upload/201903/06/1551864323_56636.jpg) 如何获取shared_prefs目录下的xml类型文件,将xml文件名如图通过ListView来一一展示,应该怎么写呢? ![图片说明](https://img-ask.csdn.net/upload/201903/06/1551864317_838.png) 下图是参照读取sd卡目录展示所有TXT类型文件写的,可是显示不出来。。感觉应该用错了。。求大佬们帮忙看看,教教怎么写,感激不尽!
语言切换为“法语”,设置 > 上方的搜索栏 > 输入任意字符 > 搜索
报错说是 SQL语法错误,发生在"écran"附近,报错只发生在法语下,其他语言正常,我数据库知识有限,看不出这句SQL语句哪里语法错误了,请大神们 帮忙分析一下.....下面是报错的语句 SELECT data_rank, data_title, data_summary_on, data_summary_off, data_entries, data_keywords, class_name, screen_title, icon, intent_action, intent_target_package, intent_target_class, enabled, data_key_reference FROM prefs_index WHERE prefs_index MATCH 'data_title:y* OR data_title_normalized:y* OR data_keywords:y*' AND locale = 'fr_FR' AND enabled = 1 AND data_rank NOT IN (SELECT data_rank FROM prefs_index WHERE prefs_index MATCH 'data_title:y* OR data_title_normalized:y* OR data_keywords:y*' AND locale = 'fr_FR' AND enabled = 1 AND (data_title = 'Fonds d'écran' AND class_name = 'com.android.settings.DeviceInfoSettings') ) ORDER BY data_rank
急急急 java 实现把bmp转换一个dcm文件,但是生成dcm文件却无法打开,求助.
代码如下 ``` import org.dcm4che3.data.Attributes; import org.dcm4che3.data.Tag; import org.dcm4che3.data.VR; import org.dcm4che3.io.DicomEncodingOptions; import org.dcm4che3.io.DicomOutputStream; import java.io.BufferedInputStream; import java.io.DataInputStream; import java.io.File; import java.io.FileInputStream; public class TwoBmp2Dcm { private static byte[] buffer = new byte[54]; private static byte[] buff = new byte[8192]; private static int imageSize; private static DicomEncodingOptions encOpts = DicomEncodingOptions.DEFAULT; public static void main(String[] args) throws Exception { File file=new File("/Users/zhangdechang/Desktop/txt/timg.bmp"); File outdcm=new File("/Users/zhangdechang/Desktop/txt/998uuuu.dcm"); DataInputStream dis=new DataInputStream(new BufferedInputStream(new FileInputStream(file))); DicomOutputStream out =new DicomOutputStream(outdcm); Attributes attrs=new Attributes(); Attributes data=new Attributes(); attrs=addMetaInformation(attrs); data=addData(data); data=readHeader(data, dis); out.writeDataset(attrs, data); out.setEncodingOptions(encOpts); out.writeHeader(Tag.PixelData, VR.OW, imageSize*2); int r; while ((r = dis.read(buff)) > 0) { out.write(buff, 0, r); } out.close(); dis.close(); } public static Attributes readHeader(Attributes attrs ,DataInputStream dis) throws Exception{ dis.read(buffer,0,54); if((buffer[0]&0xff)!=0x42&&(buffer[1]&0xff)!=0x4d){ throw new Exception("Missing BM segment in Bmp stream"); } int imageRows=byteToInt(buffer,21); int imageColumns=byteToInt(buffer,25); imageSize=byteToInt(buffer,5)-54; int biBitCount=byteTo2Int(buffer,29); attrs.setInt (Tag.SamplesPerPixel, VR.US,3); attrs.setInt(Tag.Rows, VR.US, imageColumns<0?-imageColumns:imageColumns); attrs.setInt(Tag.Columns, VR.US, imageRows); attrs.setInt(Tag.BitsAllocated, VR.US,biBitCount );//biBitCount attrs.setInt(Tag.BitsStored, VR.US,32); attrs.setInt(Tag.HighBit, VR.US, 32); attrs.setInt(Tag.PixelRepresentation, VR.US, 0); attrs.setString(Tag.PhotometricInterpretation,VR.CS, "MONOCHROME2"); //PALETTE_COLOR MONOCHROME2 attrs.setString(Tag.RescaleSlope, VR.DS, "1.0"); attrs.setString(Tag.RescaleIntercept, VR.DS, "0.0"); attrs.setString(Tag.PixelSpacing,VR.DS, "0.25/0.25"); attrs.setInt(Tag.NumberOfFrames, VR.IS, 1); return attrs; } public static Attributes addData(Attributes attrs){ attrs.setString(Tag.SpecificCharacterSet, VR.CS, "GB18030"); attrs.setString(Tag.ImageType, VR.CS, "ORIGINAL/PRIMARY/AXIAL"); attrs.setString(Tag.InstanceCreationDate, VR.DA, "20130013"); attrs.setString(Tag.InstanceCreationTime, VR.TM, "175827"); attrs.setString(Tag.SOPClassUID, VR.UI, "1.2.840.10008.5.1.4.1.1.2"); attrs.setString(Tag.SOPInstanceUID, VR.UI, "1.3.6.1.4.1.30071.6.22744165.4288391077912169.1.3"); attrs.setString(Tag.StudyDate, VR.DA, "20130803"); attrs.setString(Tag.AcquisitionDateTime, VR.DT, "20130803000000"); attrs.setString(Tag.StudyTime, VR.TM, "175532"); attrs.setString(Tag.AccessionNumber, VR.SH, "0"); attrs.setString(Tag.Modality, VR.CS, "DX"); attrs.setString(Tag.Manufacturer, VR.LO, "LargeV"); attrs.setString(Tag.StudyDescription, VR.LO, "融合扫描图像"); attrs.setString(Tag.SeriesDescription, VR.LO, "融合扫描图像"); attrs.setString(Tag.ManufacturerModelName, VR.LO, "HighRes3D"); attrs.setString(Tag.PatientName, VR.PN, "mmmm"); attrs.setString(Tag.PatientBirthDate,VR.DA,"19920720"); attrs.setString(Tag.PatientSex, VR.CS, "F"); return attrs; } public static Attributes addMetaInformation( Attributes attrs){ attrs.setString(Tag.FileMetaInformationVersion, VR.OB, ""); attrs.setString(Tag.MediaStorageSOPClassUID, VR.UI, "1.2.840.10008.5.1.4.1.1.2"); attrs.setString(Tag.MediaStorageSOPInstanceUID, VR.UI, "1.3.6.1.4.1.30071.6.22744165.4288391077912169.1.18"); attrs.setString(Tag.TransferSyntaxUID, VR.UI, "1.2.840.10008.1.2.1"); attrs.setString(Tag.ImplementationVersionName, VR.SH, "SmartVDicom1.0"); attrs.setString(Tag.ImplementationClassUID, VR.UI, "1.3.6.1.4.1.30071.6"); attrs.setString(Tag.SourceApplicationEntityTitle, VR.AE, ""); return attrs; } public static int byteToInt(byte[] bi,int end){ int a=(((int)bi[end]&0xff)<<24) ; int b=(((int)bi[end-1]&0xff)<<16) ; int c=(((int)bi[end-2]&0xff)<<8) ; int d=(int)bi[end-3]&0xff; return a+b+c+d; } public static int byteTo2Int(byte[] bi,int end){ int c=(((int)bi[end]&0xff)<<8) ; int d=(int)bi[end-1]&0xff; return c+d; } } ``` 生成的dcm文件打开报错,无法打开。 ![图片说明](https://img-ask.csdn.net/upload/201912/17/1576562077_220062.jpeg) 需要依赖的jar ``` <dependency> <groupId>com.sun.media</groupId> <artifactId>clibwrapper_jiio</artifactId> <version>1.2-pre-dr-b04</version> </dependency> <dependency> <groupId>commons-cli</groupId> <artifactId>commons-cli</artifactId> <version>1.2</version> </dependency> <dependency> <groupId>org.dcm4che</groupId> <artifactId>dcm4che-audit</artifactId> <version>3.3.7</version> </dependency> <dependency> <groupId>org.dcm4che</groupId> <artifactId>dcm4che-conf-api</artifactId> <version>3.3.7</version> </dependency> <dependency> <groupId>org.dcm4che</groupId> <artifactId>dcm4che-conf-core</artifactId> <version>3.3.7</version> </dependency> <dependency> <groupId>org.dcm4che</groupId> <artifactId>dcm4che-conf-core-api</artifactId> <version>3.3.7</version> </dependency> <dependency> <groupId>org.dcm4che</groupId> <artifactId>dcm4che-conf-dicom</artifactId> <version>3.3.7</version> </dependency> <dependency> <groupId>org.dcm4che</groupId> <artifactId>dcm4che-core</artifactId> <version>5.17.0</version> </dependency> <dependency> <groupId>org.dcm4che</groupId> <artifactId>dcm4che-emf</artifactId> <version>3.3.7</version> </dependency> <dependency> <groupId>org.dcm4che</groupId> <artifactId>dcm4che-filecache</artifactId> <version>3.3.7</version> </dependency> <dependency> <groupId>org.dcm4che</groupId> <artifactId>dcm4che-hl7</artifactId> <version>3.3.7</version> </dependency> <dependency> <groupId>org.dcm4che</groupId> <artifactId>dcm4che-image</artifactId> <version>5.17.0</version> </dependency> <dependency> <groupId>org.dcm4che</groupId> <artifactId>dcm4che-json</artifactId> <version>3.3.7</version> </dependency> <!-- https://mvnrepository.com/artifact/org.dcm4che/dcm4che-mime --> <dependency> <groupId>org.dcm4che</groupId> <artifactId>dcm4che-mime</artifactId> <version>3.3.7</version> </dependency> <dependency> <groupId>org.dcm4che</groupId> <artifactId>dcm4che-net</artifactId> <version>3.3.7</version> </dependency> <!-- https://mvnrepository.com/artifact/org.dcm4che/dcm4che-net-audit --> <dependency> <groupId>org.dcm4che</groupId> <artifactId>dcm4che-net-audit</artifactId> <version>3.3.7</version> </dependency> <dependency> <groupId>org.dcm4che</groupId> <artifactId>dcm4che-net-hl7</artifactId> <version>3.3.7</version> </dependency> <!-- https://mvnrepository.com/artifact/org.dcm4che/dcm4che-soundex --> <dependency> <groupId>org.dcm4che</groupId> <artifactId>dcm4che-soundex</artifactId> <version>3.3.7</version> </dependency> <dependency> <groupId>org.dcm4che.tool</groupId> <artifactId>dcm4che-tool-dcm2dcm</artifactId> <version>3.3.7</version> </dependency> <!-- https://mvnrepository.com/artifact/org.dcm4che.tool/dcm4che-tool-dcm2jpg --> <dependency> <groupId>org.dcm4che.tool</groupId> <artifactId>dcm4che-tool-dcm2jpg</artifactId> <version>3.3.7</version> </dependency> <!-- https://mvnrepository.com/artifact/org.dcm4che.tool/dcm4che-tool-dcm2json --> <dependency> <groupId>org.dcm4che.tool</groupId> <artifactId>dcm4che-tool-dcm2json</artifactId> <version>3.3.7</version> </dependency> <dependency> <groupId>org.dcm4che.tool</groupId> <artifactId>dcm4che-tool-dcm2xml</artifactId> <version>3.3.7</version> </dependency> <!-- https://mvnrepository.com/artifact/org.dcm4che.tool/dcm4che-tool-dcmdict --> <dependency> <groupId>org.dcm4che.tool</groupId> <artifactId>dcm4che-tool-dcmdict</artifactId> <version>3.3.7</version> </dependency> <!-- https://mvnrepository.com/artifact/org.dcm4che.tool/dcm4che-tool-dcmdir --> <dependency> <groupId>org.dcm4che.tool</groupId> <artifactId>dcm4che-tool-dcmdir</artifactId> <version>3.3.7</version> </dependency> <dependency> <groupId>org.dcm4che.tool</groupId> <artifactId>dcm4che-tool-dcmdump</artifactId> <version>3.3.7</version> </dependency> <!-- https://mvnrepository.com/artifact/org.dcm4che.tool/dcm4che-tool-dcmgen --> <dependency> <groupId>org.dcm4che.tool</groupId> <artifactId>dcm4che-tool-dcmgen</artifactId> <version>3.3.7</version> </dependency> <!-- https://mvnrepository.com/artifact/org.dcm4che.tool/dcm4che-tool-dcmqrscp --> <dependency> <groupId>org.dcm4che.tool</groupId> <artifactId>dcm4che-tool-dcmqrscp</artifactId> <version>3.3.7</version> </dependency> <dependency> <groupId>org.dcm4che.tool</groupId> <artifactId>dcm4che-tool-dcmvalidate</artifactId> <version>3.3.7</version> </dependency> <!-- https://mvnrepository.com/artifact/org.dcm4che.tool/dcm4che-tool-emf2sf --> <dependency> <groupId>org.dcm4che.tool</groupId> <artifactId>dcm4che-tool-emf2sf</artifactId> <version>3.3.7</version> </dependency> <!-- https://mvnrepository.com/artifact/org.dcm4che.tool/dcm4che-tool-findscu --> <dependency> <groupId>org.dcm4che.tool</groupId> <artifactId>dcm4che-tool-findscu</artifactId> <version>3.3.7</version> </dependency> <dependency> <groupId>org.dcm4che.tool</groupId> <artifactId>dcm4che-tool-getscu</artifactId> <version>3.3.7</version> </dependency> <!-- https://mvnrepository.com/artifact/org.dcm4che.tool/dcm4che-tool-hl7pix --> <dependency> <groupId>org.dcm4che.tool</groupId> <artifactId>dcm4che-tool-hl7pix</artifactId> <version>3.3.7</version> </dependency> <!-- https://mvnrepository.com/artifact/org.dcm4che.tool/dcm4che-tool-hl7rcv --> <dependency> <groupId>org.dcm4che.tool</groupId> <artifactId>dcm4che-tool-hl7rcv</artifactId> <version>3.3.7</version> </dependency> <!-- https://mvnrepository.com/artifact/org.dcm4che.tool/dcm4che-tool-hl7snd --> <dependency> <groupId>org.dcm4che.tool</groupId> <artifactId>dcm4che-tool-hl7snd</artifactId> <version>3.3.7</version> </dependency> <dependency> <groupId>org.dcm4che.tool</groupId> <artifactId>dcm4che-tool-hl72xml</artifactId> <version>3.3.7</version> </dependency> <!-- https://mvnrepository.com/artifact/org.dcm4che.tool/dcm4che-tool-ianscp --> <dependency> <groupId>org.dcm4che.tool</groupId> <artifactId>dcm4che-tool-ianscp</artifactId> <version>3.3.7</version> </dependency> <dependency> <groupId>org.dcm4che.tool</groupId> <artifactId>dcm4che-tool-ianscu</artifactId> <version>3.3.7</version> </dependency> <!-- https://mvnrepository.com/artifact/org.dcm4che.tool.ihe/dcm4che-tool-ihe-modality --> <dependency> <groupId>org.dcm4che.tool.ihe</groupId> <artifactId>dcm4che-tool-ihe-modality</artifactId> <version>3.3.7</version> </dependency> <!-- https://mvnrepository.com/artifact/org.dcm4che.tool/dcm4che-tool-jpg2dcm --> <dependency> <groupId>org.dcm4che.tool</groupId> <artifactId>dcm4che-tool-jpg2dcm</artifactId> <version>3.3.7</version> </dependency> <dependency> <groupId>org.dcm4che.tool</groupId> <artifactId>dcm4che-tool-json2dcm</artifactId> <version>3.3.7</version> </dependency> <!-- https://mvnrepository.com/artifact/org.dcm4che.tool/dcm4che-tool-mkkos --> <dependency> <groupId>org.dcm4che.tool</groupId> <artifactId>dcm4che-tool-mkkos</artifactId> <version>3.3.7</version> </dependency> <!-- https://mvnrepository.com/artifact/org.dcm4che.tool/dcm4che-tool-movescu --> <dependency> <groupId>org.dcm4che.tool</groupId> <artifactId>dcm4che-tool-movescu</artifactId> <version>3.3.7</version> </dependency> <!-- https://mvnrepository.com/artifact/org.dcm4che.tool/dcm4che-tool-mppsscp --> <dependency> <groupId>org.dcm4che.tool</groupId> <artifactId>dcm4che-tool-mppsscp</artifactId> <version>3.3.7</version> </dependency> <!-- https://mvnrepository.com/artifact/org.dcm4che.tool/dcm4che-tool-mppsscu --> <dependency> <groupId>org.dcm4che.tool</groupId> <artifactId>dcm4che-tool-mppsscu</artifactId> <version>3.3.7</version> </dependency> <!-- https://mvnrepository.com/artifact/org.dcm4che.tool/dcm4che-tool-prefs2xml --> <dependency> <groupId>org.dcm4che.tool</groupId> <artifactId>dcm4che-tool-prefs2xml</artifactId> <version>3.3.7</version> </dependency> <!-- https://mvnrepository.com/artifact/org.dcm4che.tool/dcm4che-tool-qc --> <dependency> <groupId>org.dcm4che.tool</groupId> <artifactId>dcm4che-tool-qc</artifactId> <version>3.3.7</version> </dependency> <dependency> <groupId>org.dcm4che.tool</groupId> <artifactId>dcm4che-tool-qidors</artifactId> <version>3.3.7</version> </dependency> <!-- https://mvnrepository.com/artifact/org.dcm4che.tool/dcm4che-tool-stgcmtscu --> <dependency> <groupId>org.dcm4che.tool</groupId> <artifactId>dcm4che-tool-stgcmtscu</artifactId> <version>3.3.7</version> </dependency> <!-- https://mvnrepository.com/artifact/org.dcm4che.tool/dcm4che-tool-storescp --> <dependency> <groupId>org.dcm4che.tool</groupId> <artifactId>dcm4che-tool-storescp</artifactId> <version>3.3.7</version> </dependency> <!-- https://mvnrepository.com/artifact/org.dcm4che.tool/dcm4che-tool-storescu --> <dependency> <groupId>org.dcm4che.tool</groupId> <artifactId>dcm4che-tool-storescu</artifactId> <version>3.3.7</version> </dependency> <!-- https://mvnrepository.com/artifact/org.dcm4che.tool/dcm4che-tool-stowrs --> <dependency> <groupId>org.dcm4che.tool</groupId> <artifactId>dcm4che-tool-stowrs</artifactId> <version>3.3.7</version> </dependency> <dependency> <groupId>org.dcm4che.tool</groupId> <artifactId>dcm4che-tool-syslog</artifactId> <version>3.3.7</version> </dependency> <!-- https://mvnrepository.com/artifact/org.dcm4che.tool/dcm4che-tool-syslogd --> <dependency> <groupId>org.dcm4che.tool</groupId> <artifactId>dcm4che-tool-syslogd</artifactId> <version>3.3.7</version> </dependency> <!-- https://mvnrepository.com/artifact/org.dcm4che.tool/dcm4che-tool-wadors --> <dependency> <groupId>org.dcm4che.tool</groupId> <artifactId>dcm4che-tool-wadors</artifactId> <version>3.3.7</version> </dependency> <!-- https://mvnrepository.com/artifact/org.dcm4che.tool/dcm4che-tool-wadouri --> <dependency> <groupId>org.dcm4che.tool</groupId> <artifactId>dcm4che-tool-wadouri</artifactId> <version>3.3.7</version> </dependency> <dependency> <groupId>org.dcm4che.tool</groupId> <artifactId>dcm4che-tool-xml2dcm</artifactId> <version>3.3.7</version> </dependency> <!-- https://mvnrepository.com/artifact/org.dcm4che.tool/dcm4che-tool-xml2hl7 --> <dependency> <groupId>org.dcm4che.tool</groupId> <artifactId>dcm4che-tool-xml2hl7</artifactId> <version>3.3.7</version> </dependency> <!-- https://mvnrepository.com/artifact/org.dcm4che.tool/dcm4che-tool-xml2prefs --> <dependency> <groupId>org.dcm4che.tool</groupId> <artifactId>dcm4che-tool-xml2prefs</artifactId> <version>3.3.7</version> </dependency> <!-- https://mvnrepository.com/artifact/org.dcm4che/dcm4che-ws-rs --> <dependency> <groupId>org.dcm4che</groupId> <artifactId>dcm4che-ws-rs</artifactId> <version>3.3.7</version> </dependency> <!-- https://mvnrepository.com/artifact/org.glassfish/javax.json --> <dependency> <groupId>org.glassfish</groupId> <artifactId>javax.json</artifactId> <version>1.0.4</version> </dependency> <dependency> <groupId>javax.json</groupId> <artifactId>javax.json-api</artifactId> <version>1.1.4</version> </dependency> <!-- https://mvnrepository.com/artifact/log4j/log4j --> <!--<dependency>--> <!--<groupId>log4j</groupId>--> <!--<artifactId>log4j</artifactId>--> <!--<version>1.2.17</version>--> <!--</dependency>--> <!-- https://mvnrepository.com/artifact/org.slf4j/slf4j-api --> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-api</artifactId> <version>1.7.25</version> </dependency> <!-- https://mvnrepository.com/artifact/org.slf4j/slf4j-log4j12 --> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-log4j12</artifactId> <version>1.7.25</version> </dependency> <!-- 倒入jar --> <dependency> <groupId>org.dcm4che</groupId> <artifactId>dcm4che-imageio</artifactId> <version>5.17.0</version> </dependency> <dependency> <groupId>org.dcm4che</groupId> <artifactId>dcm4che-imageio-rle</artifactId> <version>5.17.0</version> <scope>runtime</scope> </dependency> <dependency> <groupId>org.dcm4che</groupId> <artifactId>dcm4che-imageio-opencv</artifactId> <version>5.17.0</version> <scope>runtime</scope> </dependency> <!--<dependency>--> <!--<groupId>com.sun.media</groupId>--> <!--<artifactId>jai_imageio</artifactId>--> <!--<version>1.2-pre-dr-b04</version>--> <!--<scope>runtime</scope>--> <!--</dependency>--> <dependency> <groupId>org.dcm4che.tool</groupId> <artifactId>dcm4che-tool-common</artifactId> <version>3.3.7</version> </dependency> <dependency> <groupId>com.alibaba</groupId> <artifactId>fastjson</artifactId> <version>1.2.47</version> </dependency> ```
sharedpreference无法读取按钮状态
我需要在应用kill的时候保存按钮状态,通过sharedpreference。 在`/data/data/myapp/shared_prefs`这里可以看见按钮值true/false已经被写入了。但是在应用kill的时候读取状态出现问题。 按钮每次重启都会进入默认状态true,我在一个fragment中运行的,因此我用了: final SharedPreferences preferences = this.getActivity().getSharedPreferences("tg1pref",0); 代码如下: boolean on; public SharedPreferences preferences; final ToggleButton toggleButton1 = (ToggleButton) v.findViewById(R.id.toggleButton1); final SharedPreferences preferences = this.getActivity().getSharedPreferences("tg1pref",0); boolean tg1pref = preferences.getBoolean("tg1pref", true); if (tg1pref = true) { toggleButton1.setChecked(true); } else { toggleButton1.setChecked(false); } toggleButton1.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if((toggleButton1.isChecked())) { SharedPreferences.Editor editor = preferences.edit(); editor.putBoolean("tg1pref", true); // value to store editor.commit(); } else { SharedPreferences.Editor editor = preferences.edit(); editor.putBoolean("tg1pref", false); // value to store editor.commit(); } } });
使用shared preferences如何删除list item?
我有下面的adapter自定义类,创建了listview和items,但是我想在点击reset按钮时,从list中删除所有的items。 public class Scores extends Activity implements OnClickListener { public static final String MY_PREFS_NAME = "PrefName"; SharedPreferences pref; static String[] tempTime = new String[10]; static String[] tempScore = new String[10]; private static class EfficientAdapter extends BaseAdapter { private LayoutInflater mInflater; public EfficientAdapter(Context context) { mInflater = LayoutInflater.from(context); } public int getCount() { return tempTime.length; } public Object getItem(int position) { return position; } public long getItemId(int position) { return position; } public View getView(int position, View convertView, ViewGroup parent) { ViewHolder holder; if (convertView == null) { convertView = mInflater.inflate( R.layout.mathmatch_score_format, null); holder = new ViewHolder(); holder.text1 = (TextView) convertView .findViewById(R.id.time_text); holder.text2 = (TextView) convertView .findViewById(R.id.score_text); /*final ImageView deleteButton = (ImageView) convertView.findViewById(R.id.score_reset); deleteButton.setOnClickListener(this);*/ convertView.setTag(holder); //deleteButton.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); } holder.text1.setText(tempTime[position]); holder.text2.setText(tempScore[position]); return convertView; } static class ViewHolder { TextView text1; TextView text2; } } @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.mathmatch_score); setUpViews(); pref = getSharedPreferences(MY_PREFS_NAME, 0); strTime = pref.getString("high_score_times", ""); intScore = pref.getString("high_score_values", ""); tempTime = strTime.split(","); tempScore = intScore.split(","); Comparator<String> comparator = new CustomArrayComparator<String, String>(tempScore, tempTime); Arrays.sort(tempTime, comparator); Arrays.sort(tempScore, Collections.reverseOrder()); lv.setAdapter(new EfficientAdapter(this)); } private void setUpViews() { lv = (ListView) findViewById(R.id.list); reset = (ImageView) findViewById(R.id.score_reset); reset.setOnClickListener(this); } @Override protected void onPause() { super.onPause(); pref = getSharedPreferences(MY_PREFS_NAME, 0); SharedPreferences.Editor edit = pref.edit(); edit.putString("high_score_times", strTime); edit.putString("high_score_values", intScore); edit.commit(); } @Override protected void onStop() { super.onStop(); } @Override public void onClick(View v) { switch (v.getId()) { case R.id.score_reset: AlertDialog.Builder alertbox = new AlertDialog.Builder(this); alertbox.setTitle("Reset"); alertbox.setMessage("Are you sure all time ans score are reset?"); alertbox.setPositiveButton("Yes", new DialogInterface.OnClickListener() { public void onClick(DialogInterface arg0, int arg1) { pref = getSharedPreferences(MY_PREFS_NAME, 0); SharedPreferences.Editor edit = pref.edit(); /*edit.remove("high_score_times"); edit.remove("high_score_values");*/ /*edit.remove(intScore); edit.remove(strTime); */ //edit.clear(); edit.remove(MY_PREFS_NAME); edit.commit(); } }); alertbox.setNegativeButton("No", new DialogInterface.OnClickListener() { public void onClick(DialogInterface arg0, int arg1) { Toast.makeText(getApplicationContext(), "'No' button clicked", Toast.LENGTH_SHORT).show(); } }); alertbox.show(); break; default: break; }}} Reset按钮不在list中。上面的代码是点击yes按钮事件,但是没有任何更新。如何改正这个问题呢?
Preference Headers不显示
使用Preference-Headers重写PreferenceActivity。但是按照步骤操作之后header没显示,白屏。 XMl: <?xml version="1.0" encoding="utf-8"?> <preference-headers xmlns:android="http://schemas.android.com/apk/res/android"> <preference-headers xmlns:android="http://schemas.android.com/apk/res/android"> <header android:fragment="com.mikebdev.refuel.SettingsActivity$DesignFragment" android:title="@string/pref_header_design" android:summary="@string/pref_header_design_summary" /> <header android:fragment="com.mikebdev.refuel.SettingsActivity$SettingsFragment" android:title="@string/pref_header_units" android:summary="@string/pref_header_units_summary"/> <header android:fragment="com.mikebdev.refuel.SettingsActivity$DatabaseFragment" android:title="@string/pref_header_db" android:summary="@string/pref_header_db_summary"/> </preference-headers> </preference-headers> SettingsActivity内容: import android.app.AlertDialog; import android.content.Context; import android.content.DialogInterface; import android.os.Bundle; import android.os.Environment; import android.preference.Preference; import android.preference.PreferenceActivity; import android.preference.PreferenceFragment; import android.preference.PreferenceManager; import android.widget.Toast; import com.google.analytics.tracking.android.EasyTracker; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.util.List; public class SettingsActivity extends PreferenceActivity { public static final String PREFS_NAME = "RFPref"; public static PreferenceManager prefMgr; @Override public void onBuildHeaders(List<Header> target) { loadHeadersFromResource(R.xml.pref_headers, target); } } 不知道哪里出问题?
求大神帮我破解下一个行车记录仪的apk,不胜感激!
![图片说明](https://img-ask.csdn.net/upload/201908/08/1565250079_972409.png) ![图片说明](https://img-ask.csdn.net/upload/201908/08/1565250098_146466.png) ![图片说明](https://img-ask.csdn.net/upload/201908/08/1565250107_37226.png) 1.問題:app要求更新最新版才能使用ADAS功能,可最新版的ADAS功能很鸡肋,没法用; 旧版的app不能启用该功能,我用apktool修改了旧版的prefs.xml的代码,功能选项框默认是打开了,实际功能还是不能用;具体要修改哪里的代码才能启用该功能?对于语法,小弟完全是小白。求解!!! 2.原代码: ``` <PreferenceScreen android:title="@string/adas" android:key="prefs.adas.option" android:summary="@string/off"> <CheckBoxPreference android:title="@string/adas" android:key="prefs.adas" android:defaultValue="false" /> ``` 修改的代码如下: <PreferenceScreen android:title="@string/adas" android:key="prefs.adas.option" android:summary="@string/on"> <CheckBoxPreference android:title="@string/adas" android:key="prefs.adas" android:defaultValue="true" />
A/libc: Fatal signal 11 (SIGSEGV)
android程序中运行C++库时出现如下问题,求高手解决: 02-10 16:49:09.335 9874-9874/imeeting.shiheng.com.imeeting A/libc: Fatal signal 11 (SIGSEGV), code 1, fault addr 0xe0 in tid 9874 (ng.com.imeeting) 02-10 16:49:09.335 1080-3166/? D/LocationManagerService: getLastLocation: Request[ACCURACY_FINE gps requested=0 fastest=0 num=1] 02-10 16:49:09.365 296-296/? E/SMD: DCD ON 02-10 16:49:09.445 980-980/? I/DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** 02-10 16:49:09.445 980-980/? I/DEBUG: Build fingerprint: 'samsung/hltezm/hlte:5.0/LRX21V/N9008VZMUDPA2:user/release-keys' 02-10 16:49:09.445 980-980/? I/DEBUG: Revision: '12' 02-10 16:49:09.445 980-980/? I/DEBUG: ABI: 'arm' 02-10 16:49:09.455 980-980/? I/DEBUG: pid: 9874, tid: 9874, name: ng.com.imeeting >>> imeeting.shiheng.com.imeeting <<< 02-10 16:49:09.455 980-980/? I/DEBUG: signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0xe0 02-10 16:49:09.475 980-980/? I/DEBUG: r0 000000e0 r1 b3ae507c r2 00000001 r3 000fffff 02-10 16:49:09.475 980-980/? I/DEBUG: r4 000000e0 r5 00000000 r6 000000e0 r7 b6fd5fd8 02-10 16:49:09.475 980-980/? I/DEBUG: r8 b6fe1fb8 r9 b3ae507c sl 00000000 fp 00000003 02-10 16:49:09.475 980-980/? I/DEBUG: ip b3a00000 sp be912c68 lr b6fbbb47 pc b6f8428a cpsr 200f0030 02-10 16:49:09.475 980-980/? I/DEBUG: backtrace: 02-10 16:49:09.475 980-980/? I/DEBUG: #00 pc 0001428a /system/lib/libc.so (pthread_mutex_lock+7) 02-10 16:49:09.475 980-980/? I/DEBUG: #01 pc 0004bb43 /system/lib/libc.so (je_tcache_bin_flush_small+78) 02-10 16:49:09.475 980-980/? I/DEBUG: #02 pc 0004be05 /system/lib/libc.so (je_tcache_event_hard+52) 02-10 16:49:09.475 980-980/? I/DEBUG: #03 pc 00046525 /system/lib/libc.so (ifree+688) 02-10 16:49:09.475 980-980/? I/DEBUG: #04 pc 0000fa2b /system/lib/libc.so (free+10) 02-10 16:49:09.475 980-980/? I/DEBUG: #05 pc 0000d7e7 /system/lib/libutils.so (android::SharedBuffer::dealloc(android::SharedBuffer const*)+6) 02-10 16:49:09.475 980-980/? I/DEBUG: #06 pc 00010053 /system/lib/libutils.so (android::VectorImpl::_shrink(unsigned int, unsigned int)+154) 02-10 16:49:09.475 980-980/? I/DEBUG: #07 pc 00010f0b /system/lib/libutils.so (android::Looper::pollInner(int)+74) 02-10 16:49:09.475 980-980/? I/DEBUG: #08 pc 0001114d /system/lib/libutils.so (android::Looper::pollOnce(int, int*, int*, void**)+92) 02-10 16:49:09.475 980-980/? I/DEBUG: #09 pc 00082e61 /system/lib/libandroid_runtime.so (android::NativeMessageQueue::pollOnce(_JNIEnv*, int)+22) 02-10 16:49:09.475 980-980/? I/DEBUG: #10 pc 000b229f /system/framework/arm/boot.oat 02-10 16:49:09.895 980-980/? W/libbacktrace: virtual bool Backtrace::VerifyReadWordArgs(uintptr_t, word_t*): invalid pointer 0x131 02-10 16:49:10.025 980-980/? I/DEBUG: Tombstone written to: /data/tombstones/tombstone_08 [ 02-10 16:49:10.025 980: 980 E/ ] ro.product_ship = true [ 02-10 16:49:10.025 980: 980 E/ ] ro.debug_level = 0x4f4c 02-10 16:49:10.025 4969-4969/? E/audit: type=1701 msg=audit(1486716550.025:282): auid=4294967295 uid=10419 gid=10419 ses=4294967295 subj=u:r:untrusted_app:s0 pid=9874 comm="ng.com.imeeting" reason="memory violation" sig=11 02-10 16:49:10.035 1080-9095/? E/SharedPreferencesImpl: Couldn't create directory for SharedPreferences file shared_prefs/log_files.xml
phpadmin问题。求大神解决
![CSDN移动问答][1] 访问http://localhost/phpmyadmin/ 出现下面网页。 Index of /phpmyadmin Parent Directory .coveralls.yml CONTRIBUTING.md ChangeLog DCO LICENSE README RELEASE-DATE-4.2.0-beta1 browse_foreigners.php changelog.php chk_rel.php composer.json config.sample.inc.php db_create.php db_datadict.php db_events.php db_export.php db_import.php db_operations.php db_printview.php db_qbe.php db_routines.php db_search.php db_sql.php db_structure.php db_tracking.php db_triggers.php doc/ error_report.php examples/ export.php favicon.ico file_echo.php gis_data_editor.php import.php import_status.php index.php js/ libraries/ license.php locale/ navigation.php phpinfo.php phpmyadmin.css.php phpunit.xml.hhvm phpunit.xml.nocoverage pmd_display_field.php pmd_general.php pmd_pdf.php pmd_relation_new.php pmd_relation_upd.php pmd_save_pos.php prefs_forms.php prefs_manage.php print.css querywindow.php robots.txt schema_edit.php schema_export.php server_binlog.php server_collations.php server_databases.php server_engines.php server_export.php server_import.php server_plugins.php server_privileges.php server_replication.php server_sql.php server_status.php server_status_advisor.php server_status_monitor.php server_status_queries.php server_status_variables.php server_user_groups.php server_variables.php setup/ show_config_errors.php sql.php tbl_addfield.php tbl_change.php tbl_chart.php tbl_create.php tbl_export.php tbl_find_replace.php tbl_get_field.php tbl_gis_visualization.php tbl_import.php tbl_indexes.php tbl_move_copy.php tbl_operations.php tbl_printview.php tbl_relation.php tbl_replace.php tbl_row_action.php tbl_select.php tbl_sql.php tbl_structure.php tbl_tracking.php tbl_triggers.php tbl_zoom_select.php themes.php themes/ transformation_overview.php transformation_wrapper.php url.php user_password.php version_check.php view_create.php view_operations.php webapp.php
eclipse无法安装Tomcat8.5版本
![图片说明](https://img-ask.csdn.net/upload/201709/05/1504590194_231743.png) 重新安装了个Tomcat然后在eclipse中无法添加8.5的tomcat,求大神告知. workspace下的org.eclipse.wst.server.core.prefs和org.eclipse.jst.server.tomcat.core.prefs我已经删除还是添加不了Tomcat 原因: Tomcat版本比较特别,无法与eclipse绑定,选择8.5提示: The Apache Tomcat installation at this directory is version 8.5.12. A Tomcat 8.0 installation is expected. 解决方案:http://blog.csdn.net/change518/article/details/52577132 http://jingyan.baidu.com/album/48a42057f8dfafa92525044d.html
Android 的 Tab 不能正常运行
在 TabActivity 有一个 TabHost,在 TabHost 中有两个选项卡,每个选项卡都有自己的intent。如果一个 tab 改变,在我检测之前,这个 intent 的 onResume()方法被销毁。如何解决这个问题呢? TabActivity code: public class TabHostActivity extends TabActivity { static final int SHOW_SHARE_ACTIVITY = 0; static final int SHOW_LOGIN_ACTIVITY = 1; private TabHost tabHost; private ImageButton composeImageButton; private SharedPreferences prefs; private Bundle b; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.tabhostactivity); prefs = getSharedPreferences(Constants.PREFS_NAME, 0); //Setup the ActionBar composeImageButton = (ImageButton) findViewById(R.id.composeImageButton); composeImageButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if(prefs.getBoolean("isLoggedIn", false)) { showShareActivity(); } else { Intent intent = new Intent(TabHostActivity.this, LoginActivity.class); startActivityForResult(intent, SHOW_LOGIN_ACTIVITY); } } }); b = new Bundle(); //Setup the Tabs Resources res = getResources(); // Resource object to get Drawables tabHost = getTabHost(); // The activity TabHost tabHost.setOnTabChangedListener(new OnTabChangeListener() { @Override public void onTabChanged(String arg0) { if(tabHost.getCurrentTab() == 0) //Check if the Watchlist tab was clicked so we can prompt login { //Toast toast = Toast.makeText(getApplicationContext(), "TRENDING = YES", Toast.LENGTH_SHORT); //toast.show(); b.putBoolean("isTrendingTab",true); } else { Toast toast = Toast.makeText(getApplicationContext(), "TRENDING = NO", Toast.LENGTH_SHORT); toast.show(); b.putBoolean("isTrendingTab",false); } } }); TabHost.TabSpec spec; // Resusable TabSpec for each tab Intent intent; // Reusable Intent for each tab // Create an Intent to launch an Activity for the tab (to be reused) intent = new Intent().setClass(this, ARActivity.class); intent.putExtras(b); // Initialize a TabSpec for each tab and add it to the TabHost spec = tabHost.newTabSpec("trending").setIndicator("Trending",res.getDrawable(R.drawable.icon)).setContent(intent); tabHost.addTab(spec); // Do the same for the other tabs intent = new Intent().setClass(this, WatchlistActivity.class); intent.putExtras(b); spec = tabHost.newTabSpec("watchlist").setIndicator("Watchlist",res.getDrawable(R.drawable.icon)).setContent(intent); tabHost.addTab(spec); tabHost.setCurrentTab(0); } private void showShareActivity() { Intent intent = new Intent(TabHostActivity.this, ShareActivity.class); startActivityForResult(intent, SHOW_SHARE_ACTIVITY); } protected void onActivityResult(int requestCode, int resultCode, Intent data) { if(requestCode == SHOW_LOGIN_ACTIVITY) { //Login was successful so lets show the compose box! if (resultCode == RESULT_OK) { showShareActivity(); } } } } 这是其中一个 activity 中intent里的 onResume 方法: public void onResume() { super.onResume(); Bundle bundle = getIntent().getExtras(); if(bundle.getBoolean("isTrendingTab")) { Toast toast = Toast.makeText(getApplicationContext(), "TRENDING!", Toast.LENGTH_SHORT); toast.show(); } else { Toast toast = Toast.makeText(getApplicationContext(), "WATCHLIST!", Toast.LENGTH_SHORT); toast.show(); } }
python能成功爬取天气 不知道怎么加循环
现在能爬去数据, 但需要手动一个一个换城市和时间, 希望能加个循环,一次性爬玩选定城市所有时间的天气。 网站来自 天气网->历史天气。 网站特点:http://lishi.tianqi.com/'+position+'/'+date+'.html 我不知道怎么加循环 代码现在如下: ``` from selenium import webdriver from bs4 import BeautifulSoup import time import csv import os from openpyxl import workbook # 写入Excel表所用 chrome_options = webdriver.ChromeOptions() prefs = {"profile.managed_default_content_setting.images": 2} chrome_options.add_experimental_option("prefs", prefs) driver = webdriver.Chrome(chrome_options=chrome_options) driver.set_page_load_timeout(60) driver.set_script_timeout(60) def getId(): position = 'wulumuqi' #这里填写地方的缩拼音例如:安泽 date = '201901' #这里填写日期例如:2011年的2月 query_url = 'http://lishi.tianqi.com/'+position+'/'+date+'.html' wb = os.path.join('C:\\Users\\w4376\\OneDrive\\Desktop\\weather collecting\\') #指定路径打开 wb = workbook.Workbook() # 创建Excel对象 ws = wb.active # 获取当前正在操作的表对象 ws.append(['日期', '最高气温', '最低气温', '天气', '风向', '风力']) try: driver.get('http://tianqi.com/') time.sleep(2) driver.get(query_url) js = "window.scrollTo(0, 1800000);" driver.execute_script(js) time.sleep(2) res = driver.page_source soup = BeautifulSoup(res, 'html.parser') box = soup.find('div',class_='tqtongji2').find_all('ul')[1:] for item in box: date_detail = item.find_all('li')[0].get_text() #日期 print(date_detail) max_temperature =item.find_all('li')[1].get_text() #最高气温 print(max_temperature) min_temperature = item.find_all('li')[2].get_text() # 最低气温 print(min_temperature) temperature = item.find_all('li')[3].get_text() # 天气 print(temperature) wind_direction = item.find_all('li')[4].get_text() #风向 print( wind_direction) wind_power = item.find_all('li')[5].get_text() # 风力 if wind_power == ('微风'): wf=('0级') wind_power=wf print(wf) else: print(wind_power) if wind_direction == ('无持续风向'): wd=('无') wind_direction=wd print(wd) ws.append([date_detail, max_temperature,min_temperature, temperature, wind_direction,wind_power]) # spamwriter = csv.writer(csvfile, dialect='excel') # spamwriter.writerow([date_detail, max_temperature,min_temperature, temperature, wind_direction,wind_power]) wb.save(position+date+'.xlsx') # 存入所有信息后,保存为filename.xlsx except Exception as e: print(e) getId() ```
java.util.prefs操作注册表问题,为什么读取不到
![图片说明](https://img-ask.csdn.net/upload/201708/25/1503667218_661442.jpg) 节点明明是存在的。Preferences.userNodeForPackage(this.getClass())不是会得到HKEY_CURRENT_USER节点吗,怎么会返回false
Selenium+Chromedriver headless 无法下载文件怎么办?
如果不用 headless 则可以下载,使用 headless 则不行,有什么办法解决这个问题? 版本都是目前最新的:Selenium:3.141 Chromedriver:2.45 Chrome: 71.0.3578.80 配置如下: ``` chrome_options = webdriver.ChromeOptions() chrome_options.add_argument('--headless') chrome_options.add_argument("--disable-gpu") prefs = {'profile.default_content_settings.popups': 0, 'download.default_directory': 'E:/File/'} chrome_options.add_experimental_option('prefs', prefs) browser = webdriver.Chrome(executable_path='./chromedriver.exe', chrome_options=chrome_options) ```
csipsimple麦克风默认音量设置
请问用该项目为源码做过的大大们,麦克风默认音量除了在prefs_media.xml中进行了设置,还在那里有设置么?为什么我在默认调用的xml中修改了默认值,还是没有办法改变呢?
ubuntu lamp 无法访问phpmyadmin
addJSON( 'options', PMA_RecentTable::getInstance()->getHtmlSelectOption() ); exit; } if ($GLOBALS['PMA_Config']->isGitRevision()) { if (isset($_REQUEST['git_revision']) && $GLOBALS['is_ajax_request'] == true) { PMA_printGitRevision(); exit; } echo ' '; } // Handles some variables that may have been sent by the calling script $GLOBALS['db'] = ''; $GLOBALS['table'] = ''; $show_query = '1'; // Any message to display? if (! empty($message)) { echo PMA_Util::getMessage($message); unset($message); } $common_url_query = PMA_generate_common_url('', ''); // when $server > 0, a server has been chosen so we can display // all MySQL-related information if ($server > 0) { include 'libraries/server_common.inc.php'; include 'libraries/StorageEngine.class.php'; // Use the verbose name of the server instead of the hostname // if a value is set $server_info = ''; if (! empty($cfg['Server']['verbose'])) { $server_info .= htmlspecialchars($cfg['Server']['verbose']); if ($GLOBALS['cfg']['ShowServerInfo']) { $server_info .= ' ('; } } if ($GLOBALS['cfg']['ShowServerInfo'] || empty($cfg['Server']['verbose'])) { $server_info .= PMA_DBI_get_host_info(); } if (! empty($cfg['Server']['verbose']) && $GLOBALS['cfg']['ShowServerInfo']) { $server_info .= ')'; } $mysql_cur_user_and_host = PMA_DBI_fetch_value('SELECT USER();'); // should we add the port info here? $short_server_info = (!empty($GLOBALS['cfg']['Server']['verbose']) ? $GLOBALS['cfg']['Server']['verbose'] : $GLOBALS['cfg']['Server']['host']); } echo ' ' . "\n"; echo ' '; if ($server > 0 || count($cfg['Servers']) > 1 ) { echo ' '; echo ' ' . __('General Settings') . ' '; echo ' '; /** * Displays the MySQL servers choice form */ if ($cfg['ServerDefault'] == 0 || (! $cfg['NavigationDisplayServers'] && (count($cfg['Servers']) > 1 || ($server == 0 && count($cfg['Servers']) == 1) ) ) ) { echo ' '; include_once 'libraries/select_server.lib.php'; echo PMA_Util::getImage('s_host.png') . " " . PMA_selectServer(true, true); echo ' '; } /** * Displays the mysql server related links */ if ($server > 0 && ! PMA_DRIZZLE) { include_once 'libraries/check_user_privileges.lib.php'; // Logout for advanced authentication if ($cfg['Server']['auth_type'] != 'config') { if ($cfg['ShowChgPassword']) { $conditional_class = 'ajax'; PMA_printListItem( PMA_Util::getImage('s_passwd.png') . " " . __('Change password'), 'li_change_password', 'user_password.php?' . $common_url_query, null, null, 'change_password_anchor', "no_bullets", $conditional_class ); } } // end if echo ' '; echo ' ' . "\n" . PMA_generate_common_hidden_inputs(null, null, 4, 'collation_connection') . ' ' . "\n" . ' '. PMA_Util::getImage('s_asci.png') . " " . __('Server connection collation') . "\n" // put the doc link in the form so that it appears on the same line . PMA_Util::showMySQLDocu( 'MySQL_Database_Administration', 'Charset-connection' ) . ': ' . "\n" . ' ' . "\n" . PMA_generateCharsetDropdownBox( PMA_CSDROPDOWN_COLLATION, 'collation_connection', 'select_collation_connection', $collation_connection, true, 4, true ) . ' ' . "\n" . ' ' . "\n"; } // end of if ($server > 0 && !PMA_DRIZZLE) echo ' '; echo ' '; } echo ' '; echo ' ' . __('Appearance Settings') . ' '; echo ' '; // Displays language selection combo if (empty($cfg['Lang']) && count($GLOBALS['available_languages']) > 1) { echo ' '; include_once 'libraries/display_select_lang.lib.php'; echo PMA_Util::getImage('s_lang.png') . " " . PMA_getLanguageSelectorHtml(); echo ' '; } // ThemeManager if available if ($GLOBALS['cfg']['ThemeManager']) { echo ' '; echo PMA_Util::getImage('s_theme.png') . " " . $_SESSION['PMA_Theme_Manager']->getHtmlSelectBox(); echo ' '; } echo ' '; echo PMA_Config::getFontsizeForm(); echo ' '; echo ' '; // User preferences if ($server > 0) { echo ' '; PMA_printListItem( PMA_Util::getImage('b_tblops.png')." " .__('More settings'), 'li_user_preferences', 'prefs_manage.php?' . $common_url_query, null, null, null, "no_bullets" ); echo ' '; } echo ' '; echo ' '; echo ' '; if ($server > 0 && $GLOBALS['cfg']['ShowServerInfo']) { echo ' '; echo ' ' . __('Database server') . ' '; echo '
改变 OSMDroid 的 map tile provider 到默认的形式
在程序中,我根据用户在参数中的选择设置tiles 的源代码,用户只有2中选择-UMP和默认,例如 OpenStreetMaps。下面的代码是如何从默认的情形下改变 tiles的源代码。 SharedPreferences prefs = PreferenceManager .getDefaultSharedPreferences(getBaseContext()); if (prefs.getString("map_source_preference", "osm") == "ump") { final MapTileProviderBasic tileProvider = new MapTileProviderBasic( getApplicationContext()); final ITileSource tileSource = new XYTileSource("UMP Tiles", null, 3, 14, 256, ".png", "http://tiles.ump.waw.pl/ump_tiles/"); tileProvider.setTileSource(tileSource); final TilesOverlay tilesOverlay = new TilesOverlay(tileProvider, this.getBaseContext()); mapView.getOverlays().add(tilesOverlay); } 现在的问题是如何设置 provider 返回到OSMDroid 的默认格式?这个例子中的tileProvider.detach()运行了吗?
Eclipse报了一个没见过的错
报错如下 ``` 07-26 17:23:45.679: E/AndroidRuntime(26216): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.myweathertest/com.example.myweathertest.activities.WeatherActivity}: android.content.res.Resources$NotFoundException: String resource ID #0x0 ``` Activity如下 ``` public class WeatherActivity extends Activity implements OnClickListener { private LinearLayout weatherInfoLayout; private TextView cityNameText; private TextView publishText; ; private TextView weatherDespText; private TextView temp1Text; private TextView temp2Text; private TextView currentDateText; private Button switchCity; private Button refreshWeather; @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.weather_layout); weatherInfoLayout=(LinearLayout)findViewById(R.id.weather_info_layout); cityNameText=(TextView)findViewById(R.id.city_name); publishText=(TextView)findViewById(R.id.publish_text); weatherDespText=(TextView)findViewById(R.id.weather_desp); temp1Text=(TextView)findViewById(R.id.temp1); temp2Text=(TextView)findViewById(R.id.temp2); currentDateText=(TextView)findViewById(R.id.current_date); switchCity=(Button)findViewById(R.id.switch_city); refreshWeather=(Button)findViewById(R.id.refresh_weather); switchCity.setOnClickListener(this); refreshWeather.setOnClickListener(this); String countyName=getIntent().getStringExtra("county_name"); if(!TextUtils.isEmpty(countyName))//若从菜单中点击进去 { publishText.setText("同步中"); weatherInfoLayout.setVisibility(View.INVISIBLE); cityNameText.setVisibility(View.INVISIBLE); queryWeatherInfo(countyName); showWeather(); }else//若直接打开app { Log.d("haha", "countyName is null"); showWeather(); } } private void showWeather() { // TODO Auto-generated method stub Log.d("haha", "进入showweather"); SharedPreferences prefs=PreferenceManager.getDefaultSharedPreferences(this); cityNameText.setText(prefs.getString("city_name", "未知错误")); temp1Text.setText(prefs.getString("temp1", "")); temp2Text.setText(prefs.getString("temp2", "")); weatherDespText.setText(prefs.getString("weather_desp", "")); publishText.setText(prefs.getString("publish_time", "")+"发布"); currentDateText.setText(prefs.getString("current_time", "")); weatherInfoLayout.setVisibility(View.VISIBLE); cityNameText.setText(View.VISIBLE); } private void queryWeatherInfo(String countyName) { // TODO Auto-generated method stub Log.d("haha", "开始查询天气"); String address="http://apis.baidu.com/heweather/weather/free";//http://apis.baidu.com/heweather/weather/free Parameters param=new Parameters(); countyName=ChangeHanziToPinyin.getPinYin(countyName); Log.d("haha", "cityName is "+countyName); param.put("city", countyName); ApiStoreSDK.execute(address, ApiStoreSDK.GET, param,new ApiCallBack() { @Override public void onSuccess(int status, String responseString) { Log.d("haha", "请求成功"); Utility.handleWeatherResponse(WeatherActivity.this, responseString);//存入了sharepreferce } @Override public void onComplete() { } @Override public void onError(int status, String responseString, Exception e) { Log.d("haha", "错误进入onerror,参数为"+status); } }); } @Override public void onClick(View arg0) { // TODO Auto-generated method stub } } ``` 布局文件 ``` <?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" > <RelativeLayout android:layout_width="match_parent" android:layout_height="50dp" android:background="#484E61" > <Button android:id="@+id/switch_city" android:layout_width="30dp" android:layout_height="30dp" android:layout_centerVertical="true" android:layout_marginLeft="10dp" android:background="@drawable/home"/> <TextView android:id="@+id/city_name" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerInParent="true" android:textColor="#fff" android:textSize="24sp" /> <Button android:id="@+id/refresh_weather" android:layout_width="30dp" android:layout_height="30dp" android:layout_alignParentRight="true" android:layout_centerVertical="true" android:layout_marginRight="10dp" android:background="@drawable/refresh" /> </RelativeLayout> <RelativeLayout android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1" android:background="#27A5F9" > <TextView android:id="@+id/publish_text" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentRight="true" android:layout_marginRight="10dp" android:layout_marginTop="10dp" android:textColor="#FFF" android:textSize="18sp"/> <LinearLayout android:id="@+id/weather_info_layout" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerInParent="true" android:orientation="vertical"> <TextView android:id="@+id/current_date" android:layout_width="wrap_content" android:layout_height="40dp" android:gravity="center" android:textColor="#FFF" android:textSize="18sp"/> <TextView android:id="@+id/weather_desp" android:layout_width="wrap_content" android:layout_height="60dp" android:layout_gravity="center_horizontal" android:gravity="center" android:textColor="#FFF" android:textSize="40sp"/> <LinearLayout android:layout_width="wrap_content" android:layout_height="60dp" android:layout_gravity="center_horizontal" android:orientation="horizontal"> <TextView android:id="@+id/temp1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_vertical" android:textColor="#FFF" android:textSize="40sp" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_vertical" android:layout_marginLeft="10dp" android:layout_marginRight="10dp" android:text="~" android:textColor="#FFF" android:textSize="40sp"/> <TextView android:id="@+id/temp2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_vertical" android:textColor="#FFF" android:textSize="40sp" /> </LinearLayout> </LinearLayout> </RelativeLayout> </LinearLayout> ``` 为什么就不能启动这个Activity 呢,而且 ``` ApiStoreSDK.execute(address, ApiStoreSDK.GET, param,new ApiCallBack() { ``` 这行代码直接跳过去没执行,为什么?
eclipse tomcat 无法配置runtime environment
不懂 eclipse 加载插件的原理 按网上说的去 workspace\.metadata\.plugins\org.eclipse.core.runtime\.settings 下删除 1. org.eclipse.wst.server.core.prefs 2. org.eclipse.jst.server.tomcat.core.prefs(我的环境下找不到此文件) 环境 eclipse: Neon.1a Release (4.6.1) (安装路径:~/) tomcat:apache-tomcat-8.5.6-windows-x64 (安装路径:C:/) jdk:Java HotSpot(TM) 64-Bit Server VM (build 25.101-b13, mixed mode)(安装路径:C:\Program Files\Java\jdk1.8.0_101) tomcat任何一个版本都选择不了,path里面也设置了tomcat的bin路径 ![图片说明](https://img-ask.csdn.net/upload/201610/29/1477700894_603245.png)
Java学习的正确打开方式
在博主认为,对于入门级学习java的最佳学习方法莫过于视频+博客+书籍+总结,前三者博主将淋漓尽致地挥毫于这篇博客文章中,至于总结在于个人,实际上越到后面你会发现学习的最好方式就是阅读参考官方文档其次就是国内的书籍,博客次之,这又是一个层次了,这里暂时不提后面再谈。博主将为各位入门java保驾护航,各位只管冲鸭!!!上天是公平的,只要不辜负时间,时间自然不会辜负你。 何谓学习?博主所理解的学习,它是一个过程,是一个不断累积、不断沉淀、不断总结、善于传达自己的个人见解以及乐于分享的过程。
程序员必须掌握的核心算法有哪些?
由于我之前一直强调数据结构以及算法学习的重要性,所以就有一些读者经常问我,数据结构与算法应该要学习到哪个程度呢?,说实话,这个问题我不知道要怎么回答你,主要取决于你想学习到哪些程度,不过针对这个问题,我稍微总结一下我学过的算法知识点,以及我觉得值得学习的算法。这些算法与数据结构的学习大多数是零散的,并没有一本把他们全部覆盖的书籍。下面是我觉得值得学习的一些算法以及数据结构,当然,我也会整理一些看过...
有哪些让程序员受益终生的建议
从业五年多,辗转两个大厂,出过书,创过业,从技术小白成长为基层管理,联合几个业内大牛回答下这个问题,希望能帮到大家,记得帮我点赞哦。 敲黑板!!!读了这篇文章,你将知道如何才能进大厂,如何实现财务自由,如何在工作中游刃有余,这篇文章很长,但绝对是精品,记得帮我点赞哦!!!! 一腔肺腑之言,能看进去多少,就看你自己了!!! 目录: 在校生篇: 为什么要尽量进大厂? 如何选择语言及方...
大学四年自学走来,这些私藏的实用工具/学习网站我贡献出来了
大学四年,看课本是不可能一直看课本的了,对于学习,特别是自学,善于搜索网上的一些资源来辅助,还是非常有必要的,下面我就把这几年私藏的各种资源,网站贡献出来给你们。主要有:电子书搜索、实用工具、在线视频学习网站、非视频学习网站、软件下载、面试/求职必备网站。 注意:文中提到的所有资源,文末我都给你整理好了,你们只管拿去,如果觉得不错,转发、分享就是最大的支持了。 一、电子书搜索 对于大部分程序员...
linux系列之常用运维命令整理笔录
本博客记录工作中需要的linux运维命令,大学时候开始接触linux,会一些基本操作,可是都没有整理起来,加上是做开发,不做运维,有些命令忘记了,所以现在整理成博客,当然vi,文件操作等就不介绍了,慢慢积累一些其它拓展的命令,博客不定时更新 free -m 其中:m表示兆,也可以用g,注意都要小写 Men:表示物理内存统计 total:表示物理内存总数(total=used+free) use...
比特币原理详解
一、什么是比特币 比特币是一种电子货币,是一种基于密码学的货币,在2008年11月1日由中本聪发表比特币白皮书,文中提出了一种去中心化的电子记账系统,我们平时的电子现金是银行来记账,因为银行的背后是国家信用。去中心化电子记账系统是参与者共同记账。比特币可以防止主权危机、信用风险。其好处不多做赘述,这一层面介绍的文章很多,本文主要从更深层的技术原理角度进行介绍。 二、问题引入 假设现有4个人...
程序员接私活怎样防止做完了不给钱?
首先跟大家说明一点,我们做 IT 类的外包开发,是非标品开发,所以很有可能在开发过程中会有这样那样的需求修改,而这种需求修改很容易造成扯皮,进而影响到费用支付,甚至出现做完了项目收不到钱的情况。 那么,怎么保证自己的薪酬安全呢? 我们在开工前,一定要做好一些证据方面的准备(也就是“讨薪”的理论依据),这其中最重要的就是需求文档和验收标准。一定要让需求方提供这两个文档资料作为开发的基础。之后开发...
网页实现一个简单的音乐播放器(大佬别看。(⊙﹏⊙))
今天闲着无事,就想写点东西。然后听了下歌,就打算写个播放器。 于是乎用h5 audio的加上js简单的播放器完工了。 演示地点演示 html代码如下` music 这个年纪 七月的风 音乐 ` 然后就是css`*{ margin: 0; padding: 0; text-decoration: none; list-...
Python十大装B语法
Python 是一种代表简单思想的语言,其语法相对简单,很容易上手。不过,如果就此小视 Python 语法的精妙和深邃,那就大错特错了。本文精心筛选了最能展现 Python 语法之精妙的十个知识点,并附上详细的实例代码。如能在实战中融会贯通、灵活使用,必将使代码更为精炼、高效,同时也会极大提升代码B格,使之看上去更老练,读起来更优雅。
数据库优化 - SQL优化
以实际SQL入手,带你一步一步走上SQL优化之路!
2019年11月中国大陆编程语言排行榜
2019年11月2日,我统计了某招聘网站,获得有效程序员招聘数据9万条。针对招聘信息,提取编程语言关键字,并统计如下: 编程语言比例 rank pl_ percentage 1 java 33.62% 2 cpp 16.42% 3 c_sharp 12.82% 4 javascript 12.31% 5 python 7.93% 6 go 7.25% 7 p...
通俗易懂地给女朋友讲:线程池的内部原理
餐盘在灯光的照耀下格外晶莹洁白,女朋友拿起红酒杯轻轻地抿了一小口,对我说:“经常听你说线程池,到底线程池到底是个什么原理?”
《奇巧淫技》系列-python!!每天早上八点自动发送天气预报邮件到QQ邮箱
将代码部署服务器,每日早上定时获取到天气数据,并发送到邮箱。 也可以说是一个小型人工智障。 知识可以运用在不同地方,不一定非是天气预报。
经典算法(5)杨辉三角
杨辉三角 是经典算法,这篇博客对它的算法思想进行了讲解,并有完整的代码实现。
英特尔不为人知的 B 面
从 PC 时代至今,众人只知在 CPU、GPU、XPU、制程、工艺等战场中,英特尔在与同行硬件芯片制造商们的竞争中杀出重围,且在不断的成长进化中,成为全球知名的半导体公司。殊不知,在「刚硬」的背后,英特尔「柔性」的软件早已经做到了全方位的支持与支撑,并持续发挥独特的生态价值,推动产业合作共赢。 而对于这一不知人知的 B 面,很多人将其称之为英特尔隐形的翅膀,虽低调,但是影响力却不容小觑。 那么,在...
腾讯算法面试题:64匹马8个跑道需要多少轮才能选出最快的四匹?
昨天,有网友私信我,说去阿里面试,彻底的被打击到了。问了为什么网上大量使用ThreadLocal的源码都会加上private static?他被难住了,因为他从来都没有考虑过这个问题。无独有偶,今天笔者又发现有网友吐槽了一道腾讯的面试题,我们一起来看看。 腾讯算法面试题:64匹马8个跑道需要多少轮才能选出最快的四匹? 在互联网职场论坛,一名程序员发帖求助到。二面腾讯,其中一个算法题:64匹...
面试官:你连RESTful都不知道我怎么敢要你?
干货,2019 RESTful最贱实践
为啥国人偏爱Mybatis,而老外喜欢Hibernate/JPA呢?
关于SQL和ORM的争论,永远都不会终止,我也一直在思考这个问题。昨天又跟群里的小伙伴进行了一番讨论,感触还是有一些,于是就有了今天这篇文。 声明:本文不会下关于Mybatis和JPA两个持久层框架哪个更好这样的结论。只是摆事实,讲道理,所以,请各位看官勿喷。 一、事件起因 关于Mybatis和JPA孰优孰劣的问题,争论已经很多年了。一直也没有结论,毕竟每个人的喜好和习惯是大不相同的。我也看...
白话阿里巴巴Java开发手册高级篇
不久前,阿里巴巴发布了《阿里巴巴Java开发手册》,总结了阿里巴巴内部实际项目开发过程中开发人员应该遵守的研发流程规范,这些流程规范在一定程度上能够保证最终的项目交付质量,通过在时间中总结模式,并推广给广大开发人员,来避免研发人员在实践中容易犯的错误,确保最终在大规模协作的项目中达成既定目标。 无独有偶,笔者去年在公司里负责升级和制定研发流程、设计模板、设计标准、代码标准等规范,并在实际工作中进行...
SQL-小白最佳入门sql查询一
不要偷偷的查询我的个人资料,即使你再喜欢我,也不要这样,真的不好;
redis分布式锁,面试官请随便问,我都会
文章有点长并且绕,先来个图片缓冲下! 前言 现在的业务场景越来越复杂,使用的架构也就越来越复杂,分布式、高并发已经是业务要求的常态。像腾讯系的不少服务,还有CDN优化、异地多备份等处理。 说到分布式,就必然涉及到分布式锁的概念,如何保证不同机器不同线程的分布式锁同步呢? 实现要点 互斥性,同一时刻,智能有一个客户端持有锁。 防止死锁发生,如果持有锁的客户端崩溃没有主动释放锁,也要保证锁可以正常释...
项目中的if else太多了,该怎么重构?
介绍 最近跟着公司的大佬开发了一款IM系统,类似QQ和微信哈,就是聊天软件。我们有一部分业务逻辑是这样的 if (msgType = "文本") { // dosomething } else if(msgType = "图片") { // doshomething } else if(msgType = "视频") { // doshomething } else { // doshom...
Nginx 原理和架构
Nginx 是一个免费的,开源的,高性能的 HTTP 服务器和反向代理,以及 IMAP / POP3 代理服务器。Nginx 以其高性能,稳定性,丰富的功能,简单的配置和低资源消耗而闻名。 Nginx 的整体架构 Nginx 里有一个 master 进程和多个 worker 进程。master 进程并不处理网络请求,主要负责调度工作进程:加载配置、启动工作进程及非停升级。worker 进程负责处...
Python 编程开发 实用经验和技巧
Python是一门很灵活的语言,也有很多实用的方法,有时候实现一个功能可以用多种方法实现,我这里总结了一些常用的方法和技巧,包括小数保留指定位小数、判断变量的数据类型、类方法@classmethod、制表符中文对齐、遍历字典、datetime.timedelta的使用等,会持续更新......
YouTube排名第一的励志英文演讲《Dream(梦想)》
Idon’t know what that dream is that you have, I don't care how disappointing it might have been as you've been working toward that dream,but that dream that you’re holding in your mind, that it’s po...
“狗屁不通文章生成器”登顶GitHub热榜,分分钟写出万字形式主义大作
一、垃圾文字生成器介绍 最近在浏览GitHub的时候,发现了这样一个骨骼清奇的雷人项目,而且热度还特别高。 项目中文名:狗屁不通文章生成器 项目英文名:BullshitGenerator 根据作者的介绍,他是偶尔需要一些中文文字用于GUI开发时测试文本渲染,因此开发了这个废话生成器。但由于生成的废话实在是太过富于哲理,所以最近已经被小伙伴们给玩坏了。 他的文风可能是这样的: 你发现,...
程序员:我终于知道post和get的区别
是一个老生常谈的话题,然而随着不断的学习,对于以前的认识有很多误区,所以还是需要不断地总结的,学而时习之,不亦说乎
《程序人生》系列-这个程序员只用了20行代码就拿了冠军
你知道的越多,你不知道的越多 点赞再看,养成习惯GitHub上已经开源https://github.com/JavaFamily,有一线大厂面试点脑图,欢迎Star和完善 前言 这一期不算《吊打面试官》系列的,所有没前言我直接开始。 絮叨 本来应该是没有这期的,看过我上期的小伙伴应该是知道的嘛,双十一比较忙嘛,要值班又要去帮忙拍摄年会的视频素材,还得搞个程序员一天的Vlog,还要写BU...
加快推动区块链技术和产业创新发展,2019可信区块链峰会在京召开
11月8日,由中国信息通信研究院、中国通信标准化协会、中国互联网协会、可信区块链推进计划联合主办,科技行者协办的2019可信区块链峰会将在北京悠唐皇冠假日酒店开幕。   区块链技术被认为是继蒸汽机、电力、互联网之后,下一代颠覆性的核心技术。如果说蒸汽机释放了人类的生产力,电力解决了人类基本的生活需求,互联网彻底改变了信息传递的方式,区块链作为构造信任的技术有重要的价值。   1...
Java世界最常用的工具类库
Apache Commons Apache Commons有很多子项目 Google Guava 参考博客
相关热词 c# 图片上传 c# gdi 占用内存 c#中遍历字典 c#控制台模拟dos c# 斜率 最小二乘法 c#进程延迟 c# mysql完整项目 c# grid 总行数 c# web浏览器插件 c# xml 生成xsd
立即提问