Search Results

Search found 614 results on 25 pages for 'da didi'.

Page 20/25 | < Previous Page | 16 17 18 19 20 21 22 23 24 25  | Next Page >

  • What is the Best way to databind an ASP.NET TreeView for table with many to many parent child relati

    - by Matt W
    I've got a table which has the usual ParentID, ChildID as it's first two columns in a self-referencing tree data structure. My issue is that when I pull this out and use the following code: DataSet set = DA.GetNewCategories(); set.Relations.Add( new DataRelation("parentChildCategories", set.Tables[0].Columns["CategoryParentID"], set.Tables[0].Columns["CategoryID"]) ); StringBuilder buildXml = new StringBuilder(); StringWriter writer = new StringWriter(buildXml); set.WriteXml(writer); TreeView2.DataSource = new HierarchicalDataSet(set, "CategoryID", "CategoryParentID"); TreeView2.DataBind(); I get the error: These columns don't currently have unique values I believe this is because my data has children with multiple parent nodes. This is fine for my application - I don't mind if one row of data is rendered in multiple nodes of my TreeView. Could someone shed light on this please? It doesn't seem unreasonable to have a DataSet render XML which has nodes appearing in multiple places, but I can't figure out how to do it. Thanks, Matt.

    Read the article

  • Java & android: Help linking an item in a listView to its correct view, but not the way i know of.

    - by Capsud
    Hi, i'm developing an android app, and what i have is a String array of restaurants in one class... static final String[] AtoZ = new String[] { "Ananda", "Brambles Cafe", "Brannigans", "Buona Sera", "Cafe Mao", "Cafe Mimo", "Dante", "Eddie Rockets", "Frango's World Cuisine", "Nando's", "Overends Restaurant @ Airfield House", "Pizza Hut", "Roly Saul", "Siam Thai","Smokey Joes","Sohag Tandoori", "TGI Friday","The Rockfield Lounge", "Winters Bar", "Al Boschetto","Baan Thai", "Bella Cuba", "Bellamys","Bianconis","Canal Bank Cafe", "Canalettos Restaurant","Chandni Restaurant", "Chill Out Cafe", "Crowes", "Da Vincenzo", "Druids", "Dylan", "Epic Restaurant", "Jewel in the Crown", "Juniors", "Kanum Thai","Kites", "Koishi","Maia Restaurant", "Mangetu Restaurant", "Millers Pizza Kitchens", "O'Connells Restaurant", "Ocras Restaurant", "Orchid Szechuan Restaurant", "Roly's Bistro", "Ryans Beggars Bush", }; i have created a view for each of these restaurants aswell in my layouts folder. so this array is going to be displayed in a listView in my android app. What i want to know is what is the quickest way of linking the item clicked to its correct view, without having to type out each position in the array and have a serious of if statements which would take a year with this! i dont want to be doing something like this if(position == 1){ setContentView(R.layout.bentleys); as it would take a year doing that for each one... Please help. thanks alot.

    Read the article

  • java heap allocation

    - by gurupriyan.e
    I tried to increase the heap size like the below C:\Data\Guru\Code\Got\adminservice\adminservice>java -Xms512m -Xmx512m Usage: java [-options] class [args...] (to execute a class) or java [-options] -jar jarfile [args...] (to execute a jar file) where options include: -client to select the "client" VM -server to select the "server" VM -hotspot is a synonym for the "client" VM [deprecated] The default VM is client. -cp <class search path of directories and zip/jar files> -classpath <class search path of directories and zip/jar files> A ; separated list of directories, JAR archives, and ZIP archives to search for class files. -D<name>=<value> set a system property -verbose[:class|gc|jni] enable verbose output -version print product version and exit -version:<value> require the specified version to run -showversion print product version and continue -jre-restrict-search | -jre-no-restrict-search include/exclude user private JREs in the version search -? -help print this help message -X print help on non-standard options -ea[:<packagename>...|:<classname>] -enableassertions[:<packagename>...|:<classname>] enable assertions -da[:<packagename>...|:<classname>] -disableassertions[:<packagename>...|:<classname>] disable assertions -esa | -enablesystemassertions enable system assertions -dsa | -disablesystemassertions disable system assertions -agentlib:<libname>[=<options>] load native agent library <libname>, e.g. -agentlib:hprof see also, -agentlib:jdwp=help and -agentlib:hprof=help -agentpath:<pathname>[=<options>] load native agent library by full pathname -javaagent:<jarpath>[=<options>] load Java programming language agent, see java.lang.instrument It gave the help message as above - Does it mean that it was allocated?

    Read the article

  • Strage character encoding problem with Eclipse / Spring / Tomcat 6

    - by Czar
    Hi, I have been trying things all da but can't get a proper solution. My problem is: I am developing a Spring MVC based app in my local Tomcat. My MYSQl database has UTF-8 encoding set, all content in there displays properly when using phpMyAdmin. Also the output in LOG files using log4j in catalina.out works fine. My JSP pages are configured by <!-- encoding --> <%@ page contentType="text/html; charset=UTF-8" %> <%@ page pageEncoding="UTF-8" %> Also showing data on my JSP works fine. I can also send data from my Controller without any DB intereference using special chars, e.g. String str = "UTF-8 Test: Ä Ö Ü ß è é â"; logger.debug(str); mav.addObject("utftest", str); That displays correctly in log and on jsp page in browser. BUT: When having special chars directly in my JSP file, e.g. for text in headers, this does not work. FF and Google Chrome display strange chars but report the page to be UTF-8. When switching to Latin, the chars just get more and more strange. Same problem when showing text tokens from my messages.properties file, although Eclipse says when right-clicking that UTF-8 will be used. I am a little it lost and don't know where to check now. Summary: DB storage is fine DB output on JSP is fine Output on JSP directly form controller is fine even reading in form forms is fine .properties files and JSP text is not fine !!! Any ideas? I really appreciate and tips.

    Read the article

  • Problem with Unit testing of ASP.NET project (NullReferenceException when running the test)

    - by Alex
    Hi, I'm trying to create a bunch of MS visual studio unit tests for my n-tiered web app but for some reason I can't run those tests and I get the following error - "Object reference not set to an instance of an object" What I'm trying to do is testing of my data access layer where I use LINQ data context class to execute a certain function and return a result,however during the debugging process I found out that all the tests fail as soon as they get to the LINQ data context class and it has something to do with the connection string but I cant figure out what is the problem. The debugging of tests fails here(the second line): public EICDataClassesDataContext() : base(global::System.Configuration.ConfigurationManager.ConnectionStrings["EICDatabaseConnectionString"].ConnectionString, mappingSource) { OnCreated(); } And my test is as follows: TestMethod()] public void OnGetCustomerIDTest() { FrontLineStaffDataAccess target = new FrontLineStaffDataAccess(); // TODO: Initialize to an appropriate value string regNo = "jonh"; // TODO: Initialize to an appropriate value int expected = 10; // TODO: Initialize to an appropriate value int actual; actual = target.OnGetCustomerID(regNo); Assert.AreEqual(expected, actual); } The method which I call from DAL is: public int OnGetCustomerID(string regNo) { using (LINQDataAccess.EICDataClassesDataContext dataContext = new LINQDataAccess.EICDataClassesDataContext()) { IEnumerable<LINQDataAccess.GetCustomerIDResult> sProcCustomerIDResult = dataContext.GetCustomerID(regNo); int customerID = sProcCustomerIDResult.First().CustomerID; return customerID; } } So basically everything fails after it reaches the 1st line of DA layer method and when it tries to instantiate the LINQ data access class... I've spent around 10 hours trying to troubleshoot the problem but no result...I would really appreciate any help! UPDATE: Finally I've fixed this!!!!:) I dont know why but for some reasons in the app.config file the connection to my database was as follows: AttachDbFilename=|DataDirectory|\EICDatabase.MDF So what I did is I just changed the path and instead of |DataDirectory| I put the actual path where my MDF file sits,i.e C:\Users\1\Documents\Visual Studio 2008\Projects\EICWebSystem\EICWebSystem\App_Data\EICDatabase.mdf After I had done that it worked out!But still it's a bit not clear what was the problem...probably incorrect path to the database?My web.config of ASP.NET project contains the |DataDirectory|\EICDatabase.MDF path though..

    Read the article

  • NHibernate + Remoting = ReflectionPermission Exception

    - by Pedro
    Hi all, We are dealing with a problem when using NHibernate with Remoting in a machine with full trust enviroment (actually that's our dev machine). The problem happens when whe try to send as a parameter an object previously retrieved from the server, that contains a NHibernate Proxy in one of the properties (a lazy one). As we are in the dev machine, there's no restriction in the trust level of the web app (it's set to Full) and, as a plus, we've configured NHibernate's and Castle's assemblies to full trust in CAS (even thinking that it'd not be necessary as the remoting app in IIS has the full trust level). Does anyone have any idea of what can be causing this exception? Stack trace below. InnerException: System.Security.SecurityException Message="Falha na solicitação da permissão de tipo 'System.Security.Permissions.ReflectionPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'." Source="mscorlib" GrantedSet="" PermissionState="<IPermission class=\"System.Security.Permissions.ReflectionPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089\"\r\nversion=\"1\"\r\nFlags=\"ReflectionEmit\"/>\r\n" RefusedSet="" Url="" StackTrace: em System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark& stackMark, Boolean isPermSet) em System.Security.CodeAccessPermission.Demand() em System.Reflection.Emit.AssemblyBuilder.DefineDynamicModuleInternalNoLock(String name, Boolean emitSymbolInfo, StackCrawlMark& stackMark) em System.Reflection.Emit.AssemblyBuilder.DefineDynamicModuleInternal(String name, Boolean emitSymbolInfo, StackCrawlMark& stackMark) em System.Reflection.Emit.AssemblyBuilder.DefineDynamicModule(String name, Boolean emitSymbolInfo) em Castle.DynamicProxy.ModuleScope.CreateModule(Boolean signStrongName) em Castle.DynamicProxy.ModuleScope.ObtainDynamicModuleWithWeakName() em Castle.DynamicProxy.ModuleScope.ObtainDynamicModule(Boolean isStrongNamed) em Castle.DynamicProxy.Generators.Emitters.ClassEmitter.CreateTypeBuilder(ModuleScope modulescope, String name, Type baseType, Type[] interfaces, TypeAttributes flags, Boolean forceUnsigned) em Castle.DynamicProxy.Generators.Emitters.ClassEmitter..ctor(ModuleScope modulescope, String name, Type baseType, Type[] interfaces, TypeAttributes flags, Boolean forceUnsigned) em Castle.DynamicProxy.Generators.Emitters.ClassEmitter..ctor(ModuleScope modulescope, String name, Type baseType, Type[] interfaces, TypeAttributes flags) em Castle.DynamicProxy.Generators.Emitters.ClassEmitter..ctor(ModuleScope modulescope, String name, Type baseType, Type[] interfaces) em Castle.DynamicProxy.Generators.BaseProxyGenerator.BuildClassEmitter(String typeName, Type parentType, Type[] interfaces) em Castle.DynamicProxy.Generators.BaseProxyGenerator.BuildClassEmitter(String typeName, Type parentType, IList interfaceList) em Castle.DynamicProxy.Generators.ClassProxyGenerator.GenerateCode(Type[] interfaces, ProxyGenerationOptions options) em Castle.DynamicProxy.Serialization.ProxyObjectReference.RecreateClassProxy() em Castle.DynamicProxy.Serialization.ProxyObjectReference.RecreateProxy() em Castle.DynamicProxy.Serialization.ProxyObjectReference..ctor(SerializationInfo info, StreamingContext context) Thank you in advance.

    Read the article

  • Mysterious extra hashtable entry

    - by Harm De Weirdt
    Good evening everyone, I'm back :) Let me explain my problem. I have a hashtable in wich I store the products a costumors buys (%orders). It uses the productcode as key and has a reference to an array with the other info as value. At the end of the program, I have to rewrite the inventory to the updated version (i.e. subtract the quantity of the bought items) This is how I do this: sub rewriteInventory{ open(FILE,'>inv.txt'); foreach $key(%inventory){ print FILE "$key\|$inventory{$key}[0]\|$inventory{$key}[1]\|$inventory{$key}[2]\n" } close(FILE); } where $inventory{$key}[x] is 0 - Title, 1 - price, 2 - quantity. The problem here is that when I look at inv.txt afterwards, I see things like this: CD-911|Lady Gaga - The Fame|15.99|21 ARRAY(0x145030c)||| BOOK-1453|The Da Vinci Code - Dan Brown|14.75|12 ARRAY(0x145bee4)||| Where do these "ARRAY(0x145030c)|||" entries come from? Or more important, how do I get rid of them? This is the last part of this school task, I had so much problems programming all this and this stupid little thing comes up now and I'm really fed up with this whole Perl thing. (this aside :p) I hope someone can help me :) Fuji

    Read the article

  • Can someone help me with m Django localization?

    - by alex
    I have a template with has text in it. It's located in /templates under my project directory. I'm trying to do Japanese now. I create a directory called "locale" in my project directory. Then, I set up this in my settings: gettext = lambda s: s LANGUAGES = ( ('de', gettext('German')), ('en', gettext('English')), ('ja', gettext('Japanese')), ) After that, I run this command: django-admin.py makemessages -l ja The only problem is, this doesn't work! In my locale/ja/LC_MESSAGES/django.po: Isn't it supposed to scan my templates with .html extension and grab all the strings? # SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. # #, fuzzy msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2010-05-20 22:45+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <[email protected]>\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: settings.py:101 msgid "German" msgstr "" #: settings.py:102 msgid "English" msgstr "" #: settings.py:103 msgid "Japanese" msgstr ""

    Read the article

  • Python beginer having trouble running code

    - by Protean
    For some reason this code will not seem to run in the interpreter. When I hit F5 nothing happens, not even the debugger seems to recognize it. I assume it has something to do with the class, as when removed the interpreter seems to recognize the rest of the code. Please tell me what I am doing wrong. Edit: I have restarted the interpreter multiple times, any other piece of code I try to load runs fine, just this one is having trouble. print ('Why won't this work?') class sorting_class: def __init__(self): self.order = ['a', 'b', 'c', 'd'] self.globali = 0 self.orderi = 0 self.sortedlist = [] def sort(self, array): carry, leave = [] for arrayi in array: print ('run', arrayi) if self.order[self.orderi] == arrayi[self.globali]: carry.append(arrayi) else: if self.globali != 0: leave.append(arrayi) return carry, leave def srt(self, array): globalii = 0 carry, leave = my.sort(array) while len(self.sortedlist) != len(array): if len(self.carry) == 1: self.sortedlist.append(carry) arrayt = leave self.globali = 1 self.orderi = 0 carry, leave = my.sort(arrayt) elif len(self.carry) == 0: if len(self.leave) != 0: arrayt = leave self.globali = 1 self.orderi += 1 my.sort(arrayt) else: self.arrayt globalii += 1 self.orderi = globalii self.globali = 0 my.sort(arrayt) self.orderi = 0 else: arrayt = carry carry = [] self.globali += 1 carry, leave += my.sort(arrayt) my = sorting_class() x = ['ac', 'bc' ,'ab', 'da'] my.srt(x)

    Read the article

  • PHP and Gettext not work on my server!

    - by NeoNmaN
    i have this site ( http://rssbot.dk/en/ ) i try to get gettext to work so my english, sweiden and norway site can comming up. Bot i can't get it to work, what have i doe wrong? this is my config code // define constants ( defualt - danish ) $lang = 'da_DA'; $lang_short = ''; $lang_prefix = 'da'; if ( isset( $_GET['lang'] ) ) { switch( $_GET['lang'] ) { case 'en': $lang = 'en_EN'; $lang_short = 'en/'; $lang_prefix = 'en'; break; case 'se': $lang = 'se_SE'; $lang_short = 'se/'; $lang_prefix = 'se'; break; case 'no': $lang = 'no_NO'; $lang_short = 'no/'; $lang_prefix = 'no'; break; } } define( 'LANG', $lang_short ); define( 'LANG_PREFIX', $lang_prefix ); putenv("LC_ALL=". $lang ); bindtextdomain('messages', ROOT .'lang/'); and my path is /var/www/rssbot.dk/lang/ folder. shut i make chmod right or? i hob to can be helpet

    Read the article

  • Android Html.fromHtml

    - by user3688154
    hi take from database a String like this: "Frog Revolution <\strong<\span<\p\r\nUn mix perfetto di design e praticità, che stimola il piacere dello sguardo.<\span<\p\r\nLa Frog è una macchina da caffè espresso a cialde destinata sia al mercato domestico che quello aziendale. <\span<\p\r\nIl suo design innovativo, la sua semplicità e la qualità delle sue componenti, la rendono un bene strumentale affidabile a cui puntare in tutta tranquillità. <\span<\p\r\nDIMENSIONI:<\strong<\span<\p\r\n\r\nLarghezza: 22 cm <\span<\li\r\nAltezza: 40 cm<\span<\li\r\nProfondità: 32 cm<\span<\li\r\nPeso: 6.5 Kg<\span<\li\r\n<\ul\r\nCARATTERISTICHE TECNICHE<\strong<\span<\p\r\n\r\nPotenza normale 650 W <\span<\li\r\nVoltaggio 230 V<\span<\li\r\nSistema di decalcificazione rapido <\span<\li\r\nAlloggio bottiglia d'acqua <\span<\li\r\n<\ul\r\nACCESSORI<\strong<\span<\p\r\n\r\nVano porta cialde e bicchieri<\span<\li\r\n<\ul" now i try to put it in a TextView with Html.fromHtml() method…but without success..Can you help me?

    Read the article

  • wordpress extended_valid_elements for script tag?

    - by John
    Can someone tell me how to tell Wordpress' tinymce editor to NOT strip out script tags? I looked in wp-admin/includes/post.php and added 'extended_valid_elements'=>'script[charset|defer|language|src|type]', to the $initArray. When I do a view source on the CMS post editor, I see taht it does show up like so: <script type="text/javascript"> /* <![CDATA[ */ tinyMCEPreInit = { base : "http://dev.esolar.ca/wp-includes/js/tinymce", suffix : "", query : "ver=327-1235", mceInit : {mode:"specific_textareas", editor_selector:"theEditor", width:"100%", theme:"advanced", skin:"wp_theme", theme_advanced_buttons1:"bold,italic,strikethrough,|,bullist,numlist,blockquote,|,justifyleft,justifycenter,justifyright,|,link,unlink,wp_more,|,spellchecker,fullscreen,wp_adv", theme_advanced_buttons2:"formatselect,underline,justifyfull,forecolor,|,pastetext,pasteword,removeformat,|,charmap,|,outdent,indent,|,undo,redo,wp_help", theme_advanced_buttons3:"", theme_advanced_buttons4:"", language:"en", spellchecker_languages:"+English=en,Danish=da,Dutch=nl,Finnish=fi,French=fr,German=de,Italian=it,Polish=pl,Portuguese=pt,Spanish=es,Swedish=sv", theme_advanced_toolbar_location:"top", theme_advanced_toolbar_align:"left", theme_advanced_statusbar_location:"bottom", theme_advanced_resizing:"1", theme_advanced_resize_horizontal:"", dialog_type:"modal", relative_urls:"", remove_script_host:"", convert_urls:"", apply_source_formatting:"", remove_linebreaks:"1", gecko_spellcheck:"1", entities:"38,amp,60,lt,62,gt", accessibility_focus:"1", tabfocus_elements:"major-publishing-actions", media_strict:"", paste_remove_styles:"1", paste_remove_spans:"1", paste_strip_class_attributes:"all", wpeditimage_disable_captions:"", plugins:"safari,inlinepopups,spellchecker,paste,wordpress,media,fullscreen,wpeditimage,wpgallery,tabfocus"}, load_ext : function(url,lang){var sl=tinymce.ScriptLoader;sl.markDone(url+'/langs/'+lang+'.js');sl.markDone(url+'/langs/'+lang+'_dlg.js');} }; /* ]]> */ </script> But for some reason ,my editor still doesn't save <script> tags. What am I doing wrong?

    Read the article

  • Problem when trying to connect to a desktop server from android on wifi

    - by thiagolee
    Hello, I am trying to send a file from the phone running Android 1.5 to a server on a desktop. I wrote some code, which works on emulator, but on the phone it doesn't. I'm connecting to the network through WiFi. It works, I can access the internet through my phone and I've configured my router. The application stops when I'm trying to connect. I have the permissions. Someone have any ideas, below is my code. Running on Android package br.ufs.reconhecimento; import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.net.Socket; import android.app.Activity; import android.app.AlertDialog; import android.content.DialogInterface; import android.content.Intent; import android.os.Bundle; import android.util.Log; import android.view.View; import android.view.View.OnClickListener; import android.widget.EditText; import android.widget.ImageButton; /** * Sample code that invokes the speech recognition intent API. */ public class Reconhecimento extends Activity implements OnClickListener { static final int VOICE_RECOGNITION_REQUEST_CODE = 1234; static final String LOG_VOZ = "UFS-Reconhecimento"; final int INICIAR_GRAVACAO = 01; int porta = 5158; // Porta definida no servidor int tempoEspera = 1000; String ipConexao = "172.20.0.189"; EditText ipEdit; /** * Called with the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Inflate our UI from its XML layout description. setContentView(R.layout.main); // Get display items for later interaction ImageButton speakButton = (ImageButton) findViewById(R.id.btn_speak); speakButton.setPadding(10, 10, 10, 10); speakButton.setOnClickListener(this); //Alerta para o endereço IP AlertDialog.Builder alerta = new AlertDialog.Builder(this); alerta.setTitle("IP");//+mainWifi.getWifiState()); ipEdit = new EditText(this); ipEdit.setText(ipConexao); alerta.setView(ipEdit); alerta.setMessage("Por favor, Confirme o endereço IP."); alerta.setPositiveButton("OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { ipConexao = ipEdit.getText().toString(); Log.d(LOG_VOZ, "Nova Atribuição do Endreço IP: " + ipConexao); } }); alerta.create(); alerta.show(); } /** * Handle the click on the start recognition button. */ public void onClick(View v) { if (v.getId() == R.id.btn_speak) { //startVoiceRecognitionActivity(); Log.d(LOG_VOZ, "Iniciando a próxima tela"); Intent recordIntent = new Intent(this, GravacaoAtivity.class); Log.d(LOG_VOZ, "Iniciando a tela (instancia criada)"); startActivityForResult(recordIntent, INICIAR_GRAVACAO); Log.d(LOG_VOZ, "Gravação iniciada ..."); } } /** * Handle the results from the recognition activity. */ @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { Log.d(LOG_VOZ, "Iniciando onActivityResult()"); if (requestCode == INICIAR_GRAVACAO && resultCode == RESULT_OK) { String path = data.getStringExtra(GravacaoAtivity.RETORNO); conexaoSocket(path); } else Log.e(LOG_VOZ, "Resultado Inexperado ..."); } private void conexaoSocket(String path) { Socket socket = SocketOpener.openSocket(ipConexao, porta, tempoEspera); if(socket == null) return; try { DataOutputStream conexao = new DataOutputStream(socket.getOutputStream()); Log.d(LOG_VOZ, "Acessando arquivo ..."); File file = new File(path); DataInputStream arquivo = new DataInputStream(new FileInputStream(file)); Log.d(LOG_VOZ, "Iniciando Transmissão ..."); conexao.writeLong(file.length()); for(int i = 0; i < file.length(); i++) conexao.writeByte(arquivo.readByte()); Log.d(LOG_VOZ, "Transmissão realizada com sucesso..."); Log.d(LOG_VOZ, "Fechando a conexão..."); conexao.close(); socket.close(); Log.d(LOG_VOZ, "============ Processo finalizado com Sucesso =============="); } catch (IOException e) { Log.e(LOG_VOZ, "Erro ao fazer a conexão via Socket. " + e.getMessage()); // TODO Auto-generated catch block } } } class SocketOpener implements Runnable { private String host; private int porta; private Socket socket; public SocketOpener(String host, int porta) { this.host = host; this.porta = porta; socket = null; } public static Socket openSocket(String host, int porta, int timeOut) { SocketOpener opener = new SocketOpener(host, porta); Thread t = new Thread(opener); t.start(); try { t.join(timeOut); } catch(InterruptedException e) { Log.e(Reconhecimento.LOG_VOZ, "Erro ao fazer o join da thread do socket. " + e.getMessage()); //TODO: Mensagem informativa return null; } return opener.getSocket(); } public void run() { try { socket = new Socket(host, porta); }catch(IOException e) { Log.e(Reconhecimento.LOG_VOZ, "Erro na criação do socket. " + e.getMessage()); //TODO: Mensagem informativa } } public Socket getSocket() { return socket; } } Running on the desktop Java: import java.io.BufferedReader; import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStreamReader; import java.net.ServerSocket; import java.net.Socket; public class ServidorArquivo { private static int porta = 5158; static String ARQUIVO = "voz.amr"; /** * Caminho que será gravado o arquivo de audio */ static String PATH = "/home/iade/Trabalho/lib/"; public static void main(String[] args) { int i = 1; try { System.out.println("Iniciando o Servidor Socket - Android."); ServerSocket s = new ServerSocket(porta); System.out.println("Servidor Iniciado com Sucesso..."); System.out.println("Aguardando conexões na porta: " + porta); while(true) { Socket recebendo = s.accept(); System.out.println("Aceitando conexão de nº " + i); new ThreadedHandler(recebendo).start(); i++; } } catch (Exception e) { System.out.println("Erro: " + e.getMessage()); e.printStackTrace(); } } } class ThreadedHandler extends Thread { private Socket socket; public ThreadedHandler(Socket so) { socket = so; } public void run() { DataInputStream entrada = null; DataOutputStream arquivo = null; try { entrada = new DataInputStream(socket.getInputStream()); System.out.println("========== Iniciando a leitura dos dados via Sockets =========="); long tamanho = entrada.readLong(); System.out.println("Tamanho do vetor " + tamanho); File file = new File(ServidorArquivo.PATH + ServidorArquivo.ARQUIVO); if(!file.exists()) file.createNewFile(); arquivo = new DataOutputStream(new FileOutputStream(file)); for(int j = 0; j < tamanho; j++) { arquivo.write(entrada.readByte()); } System.out.println("========== Dados recebidos com sucesso =========="); } catch (Exception e) { System.out.println("Erro ao tratar do socket: " + e.getMessage()); e.printStackTrace(); } finally { System.out.println("**** Fechando as conexões ****"); try { entrada.close(); socket.close(); arquivo.close(); } catch (IOException e) { System.out.println("Erro ao fechar conex&#65533;es " + e.getMessage()); e.printStackTrace(); } } System.out.println("============= Fim da Gravação ==========="); // tratar o arquivo String cmd1 = "ffmpeg -i voz.amr -ab 12288 -ar 16000 voz.wav"; String cmd2 = "soundstretch voz.wav voz2.wav -tempo=100"; String dir = "/home/iade/Trabalho/lib"; File workDir = new File(dir); File f1 = new File(dir+"/voz.wav"); File f2 = new File(dir+"/voz2.wav"); f1.delete(); f2.delete(); try { executeCommand(cmd1, workDir); System.out.println("realizou cmd1"); executeCommand(cmd2, workDir); System.out.println("realizou cmd2"); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } private void executeCommand(String cmd1, File workDir) throws IOException, InterruptedException { String s; Process p = Runtime.getRuntime().exec(cmd1,null,workDir); int i = p.waitFor(); if (i == 0) { BufferedReader stdInput = new BufferedReader(new InputStreamReader(p.getInputStream())); // read the output from the command while ((s = stdInput.readLine()) != null) { System.out.println(s); } } else { BufferedReader stdErr = new BufferedReader(new InputStreamReader(p.getErrorStream())); // read the output from the command while ((s = stdErr.readLine()) != null) { System.out.println(s); } } } } Thanks in advance.

    Read the article

  • Storing unique values into an array and comparing against a loop - PHP

    - by Aphex22
    I'm writing a PHP report which is designed to be exported purely as a CSV file, using commma delimiters. There are three columns relating to product_id, these three columns are as follows: SKU Parent / Child Parent SKU 12345 parent 12345 12345_1 child 12345 12345_2 child 12345 12345_3 child 12345 12345_4 child 12345 18099 parent 18099 18099_1 child 18099 Here's a link to the full CSV file: http://i.imgur.com/XELufRd.png At the moment the code looks like this: $sql = "select * from product WHERE on_amazon = 'on' AND active = 'on'"; $result = mysql_query($sql) or die ( mysql_error() );?> <? // set headers echo " Type, SKU, Parent / Child, Parent SKU, Product name, Manufacturer name, Gender, Product_description, Product price, Discount price, Quantity, Category, Photo 1, Photo 2, Photo 3, Photo 4, Photo 5, Photo 6, Photo 7, Photo 8, Color id, Color name, Size name <br> "; // load all stock while ($line = mysql_fetch_assoc($result) ) { ?> <?php // Loop through each possible size variation to see whether any of the quantity column has stock > 0 $con_size = array (35,355,36,37,375,38,385,39,395,40,405,41,415,42,425,43,435,44,445,45,455,46,465,47,475,48,485); $arrlength=count($con_size); for($x=0;$x<$arrlength;$x++) { // check if size is available if($line['quantity_c_size_'.$con_size[$x].'_chain'] > 0 ) { ?> <? echo 'Shoes'; ?>, <?=$line['product_id']?>, , , <?=$line['title']?>, <? $brand = $line['jys_brand']; echo ucfirst($brand); ?>, <? $gender = $line['category']; if ($gender == 'Mens') { echo 'H'; } else{ echo 'F'; } ?>, <?=preg_replace('/[^\da-z]/i', ' ', $line['amazon_desc']) ?>, <?=$line['price']?>, <?=$line['price']?>, <?=$line['quantity_c_size_'.$con_size[$x].'_chain']?>, <? $category = $line['style1']; switch ($category) { case "ankle-boots": echo "10013"; break; case "knee-high-boots": echo "10011"; break; case "high-heel-boots": echo "10033"; break; case "low-heel-boots": echo "10014"; break; case "wedge-boots": echo "10014"; break; case "western-boots": echo "10032"; break; case "flat-shoes": echo "10034"; break; case "high-heel-shoes": echo "10039"; break; case "low-heel-shoes": echo "10039"; break; case "wedge-shoes": echo "10035"; break; case "ballerina-shoes": echo "10008"; break; case "boat-shoes": echo "10018"; break; case "loafer-shoes": echo "10037"; break; case "work-shoes": echo "10039"; break; case "flat-sandals": echo "10041"; break; case "low-heel-sandals": echo "10042"; break; case "high-heel-sandals": echo "10042"; break; case "wedge-sandals": echo "10042"; break; case "mule-sandals": echo "10038"; break; case "mary-jane-shoes": echo "10039"; break; case "sports-shoes": echo "10026"; break; case "court-shoes": echo "10035"; break; case "peep-toe-shoes": echo "10035"; break; case "flat-boots": echo "10609"; break; case "mid-calf-boots": echo "10014"; break; case "trainer-shoes": echo "10009"; break; case "wellington-boots": echo "10012"; break; case "lace-up-boots": echo "10609"; break; case "chelsea-and-jodphur-boots": echo "10609"; break; case "desert-and-chukka-boots": echo "10032"; break; case "lace-up-shoes": echo "10034"; break; case "slip-on-shoes": echo "10043"; break; case "gibson-and-derby-shoes": echo "10039"; break; case "oxford-shoes": echo "10039"; break; case "brogue-shoes": echo "10039"; break; case "winter-boots": echo "10021"; break; case "slipper-shoes": echo "10016"; break; case "mid-heel-shoes": echo "10039"; break; case "sandals-and-beach-shoes": echo "10044"; break; case "mid-heel-sandals": echo "10042"; break; case "mid-heel-boots": echo "10014"; break; default: echo ""; } ?>, http://www.getashoe.co.uk/full/<?=$line['product_id']?>_1.jpg, http://www.getashoe.co.uk/full/<?=$line['product_id']?>_2.jpg, http://www.getashoe.co.uk/full/<?=$line['product_id']?>_3.jpg, http://www.getashoe.co.uk/full/<?=$line['product_id']?>_4.jpg, , , , , <? $colour = preg_replace('/[^\da-z]/i', ' ', $line['colour']); if( preg_match( '/white.*/i', $colour)) { echo '1'; } elseif( preg_match( '/yellow.*/i', $colour)) { echo '4'; } elseif( preg_match( '/orange.*/i', $colour)) { echo '7'; } elseif( preg_match( '/red.*/i', $colour)) { echo '8'; } elseif( preg_match( '/pink.*/i', $colour)) { echo '13'; } elseif( preg_match( '/purple.*/i', $colour)) { echo '15'; } elseif( preg_match( '/blue.*/i', $colour)) { echo '19'; } elseif( preg_match( '/green.*/i', $colour)) { echo '25'; } elseif( preg_match( '/brown.*/i', $colour)) { echo '28'; } elseif( preg_match( '/grey.*/i', $colour)) { echo '35'; } elseif( preg_match( '/black.*/i', $colour)) { echo '38'; } elseif( preg_match( '/gold.*/i', $colour)) { echo '41'; } elseif( preg_match( '/silver.*/i', $colour)) { echo '46'; } elseif( preg_match( '/multi.*/i', $colour)) { echo '594'; } elseif( preg_match( '/beige.*/i', $colour)) { echo '6887'; } elseif( preg_match( '/nude.*/i', $colour)) { echo '6887'; } else { echo '534'; } ?>, <?=$line['colour']?>, <?=$con_size[$x]?> <br> <? // finish checking if size is available } } ?> So at the moment this is simply echoing out the product_ID into the SKU column. The code would need to enter the product_id into an array and check whether it is unique. If the product_id is unique to the array, then the product_id is echoed out unaltered, and parent is echoed out to the 'Parent/Child' column and then the product_id is repeated to the 'Parent SKU' column. However, if the array is checked and the product_id already exists in the array, then the product_id is echoed out to the 'SKU' column with a suffix i.e. _1. Then child is echoed to the 'Parent / Child' column and the original parent product_id echoed to the 'Parent SKU' column. HOWEVER - the same SKU cannot be repeated with the same suffix i.e. 12345_1, 12345_1 - so presumably there would be to be another array for the suffixed SKUs to be checked against. If anybody could help, it would be great. Thanks --- UPDATE ANSWER --- I managed to solved this myself and thought I would share my solution for future reference. /* * Array to collect product_ids and check whether unique. * If unique product_id becomes parent SKU * If not product_id becomes child of previous parent and suffixed with _1, _2 etc... */ if (!in_array($line['product_id'], $SKU)) { $SKU[] = $line['product_id']; $parent = $line['product_id']; $a = 0; ?> <? echo 'Shoes'; ?>, <? echo $parent; ?>, <? echo "Parent"; ?>, <? echo $parent; ?>, <? } else { $child = $line['product_id'] . "_" . $a; ?> <? echo 'Shoes'; ?>, <? echo $child; ?>, <? echo "Child"; ?>, <? echo $child; <? // increment suffix value for child SKU $a++; ?>

    Read the article

  • ecma script deleting in a <select> "list"

    - by Tyzak
    hello, i have following function: function delete_auswahl() { var anzahl =document.getElementById ("warenkorbfeld").length ; for (var i =0; i<=anzahl; i++) { if (document.getElementById ("warenkorbfeld").options[i].selected==true) { if (document.getElementById ("warenkorbfeld").options[i].id == "Margherita" ) gesamtbetrag = gesamtbetrag - 4; if (document.getElementById ("warenkorbfeld").options[i].id=="Salami" ) gesamtbetrag = gesamtbetrag - 4.50; if (document.getElementById ("warenkorbfeld").options[i].id=="Hawaii" ) gesamtbetrag = gesamtbetrag - 5.50; document.getElementById ("warenkorbfeld").options[i]=null; i--;// auf der gleichen stelle bleiben, da dass nächste feld nachrückt } } document.getElementById('gesamtbetrag').innerHTML=gesamtbetrag ; } before i added values with function hinzu (pizza) { NeuerEintrag = new Option(pizza, pizza, false, false); document.getElementById("warenkorbfeld").options[document.getElementById("warenkorbfeld").length] = NeuerEintrag ; if (pizza=="Margherita") { gesamtbetrag = gesamtbetrag + 4; } if (pizza=="Salami") { gesamtbetrag = gesamtbetrag + 4.50; } if (pizza=="Hawaii") { gesamtbetrag = gesamtbetrag + 5.50; } document.getElementById('gesamtbetrag').innerHTML=gesamtbetrag ; } now, in the delete function doesn't substract the price. despite this, all works. what's wrong with this term? if (document.getElementById ("warenkorbfeld").options[i].id == "Margherita" ) gesamtbetrag = gesamtbetrag - 4; thanks in advance

    Read the article

  • GridView does not display correcty sorted Data when i click column

    - by user329419
    Date column does not display in sorted in GridView using vb.net. In sql server the select query is returning records in sorted manner or in order by. But for some reason GridView does not display properly. it goes to an event preRenderComplete then it binds automatically Protected Sub Page_PreRenderComplete(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.PreRenderComplete 'Force the selections made in page_load to be shown in the gridview by causing a postback GridView1.DataBind() If GridView1.Rows.Count > 0 Then 'this is not counting correctly disable until i get it figured out '' lblMsg.Text = GridView1.Rows.Count.ToString + " Referrals" Else lblMsg.Text() = "No referrals to be processed" End If 'Turn off the Background Contolls 'If Not IsPostBack Then PanelBackendControls.Visible = False End Sub End Region _ Public Shared Function A02WF01_AdminView(ByVal strUserID As String, ByVal strTestMode As String, ByVal strSearchFieldValue As String, ByVal strDate As String) As DataTable Dim sel As String Dim conn As SqlConnection = New SqlConnection(WF01ConnectionString) If strSearchFieldValue <> "" And strTestMode = "ON" Then sel = "SELECT DISTINCT Since, WorkFlow_Step, " sel = sel & " Started_By, Client_FullName, Product_Desc, " sel = sel & " Branch_List, Event_AssignedID, DaysElapsed, Status,Instance_ID,Seq_ID,Form_Code " sel = sel & " FROM A02W01ViewAllTest " Dim WhereClause As String Dim OrderClause As String WhereClause = " WHERE ( Event_IsLatest = 1)" If strUserID <> "Admin" Then End If 'WhereClause = WhereClause + " AND WF_Start_UserID like " + "'" + strUserID + "')" WhereClause = WhereClause + " And( Started_By Like " + "'%" + strSearchFieldValue + "%'" WhereClause = WhereClause + " OR Client_FullName Like " + "'%" + strSearchFieldValue + "%'" 'WhereClause = WhereClause + " OR FullName Like " + "'%" + strSearchFieldValue + "%'" WhereClause = WhereClause + " OR Product_Desc Like " + "'%" + strSearchFieldValue + "%'" WhereClause = WhereClause + " OR Branch_List Like " + "'%" + strSearchFieldValue + "%'" WhereClause = WhereClause + " OR DaysElapsed Like " + "'%" + strSearchFieldValue + "%')" 'WhereClause = WhereClause + " OR Form_Code Like " + "'%" + strSearchFieldValue + "%')" OrderClause = " ORDER BY Since DESC" sel = sel + WhereClause + OrderClause ElseIf strSearchFieldValue <> "" And strTestMode <> "ON" Then sel = "SELECT DISTINCT Since, WorkFlow_Step, " sel = sel & " Started_By, Client_FullName, Product_Desc, " sel = sel & " Branch_List, Event_AssignedID, DaysElapsed, Status " sel = sel & " FROM A02W01ViewAll " Dim WhereClause As String Dim OrderClause As String WhereClause = " WHERE ( Event_IsLatest = 1)" If strUserID <> "Admin" Then End If 'WhereClause = WhereClause + " AND WF_Start_UserID like " + "'" + strUserID + "')" WhereClause = WhereClause + " AND( Started_By Like " + "'%" + strSearchFieldValue + "%'" WhereClause = WhereClause + " OR Client_FullName Like " + "'%" + strSearchFieldValue + "%'" 'WhereClause = WhereClause + " OR Client_LastName Like " + "'%" + strSearchFieldValue + "%'" WhereClause = WhereClause + " OR Product_Desc Like " + "'%" + strSearchFieldValue + "%'" WhereClause = WhereClause + " OR Branch_List Like " + "'%" + strSearchFieldValue + "%'" WhereClause = WhereClause + " OR DaysElapsed Like " + "'%" + strSearchFieldValue + "%'))" 'WhereClause = WhereClause + " OR Form_Code Like " + "'%" + strSearchFieldValue + "%'))" OrderClause = " ORDER BY Since DESC" sel = sel + WhereClause + OrderClause End If If strTestMode <> "ON" And strSearchFieldValue = "" Then sel = "SELECT DISTINCT Since, WorkFlow_Step, " sel = sel & " Started_By, Client_LastName, Client_FullName, Product_Desc, " sel = sel & " Branch_List, Event_AssignedID, DaysElapsed, Status " sel = sel & " FROM A02W01ViewAll " Dim WhereClause As String Dim OrderClause As String WhereClause = " WHERE Event_IsLatest = 1" 'WhereClause = WhereClause + " AND (Event_IsLatest = 1) " OrderClause = " ORDER BY Since DESC" sel = sel + WhereClause + OrderClause Else If strSearchFieldValue = "" And strTestMode = "ON" And strDate = "" Then sel = "SELECT DISTINCT Since, WorkFlow_Step, " sel = sel & " Started_By, Client_FullName, Product_Desc, " sel = sel & " Branch_List, Event_AssignedID, DaysElapsed, Status, Instance_ID,Seq_ID,Form_Code " sel = sel & " FROM A02W01ViewAllTest " Dim WhereClause As String Dim OrderClause As String WhereClause = " WHERE Event_IsLatest = 1" 'Display everything for Admin ' Comment below code 'If strUserID <> "Admin" Then WhereClause = WhereClause + " AND WF_Start_UserID like " + "'" + strUserID + "'" OrderClause = " ORDER BY Since DESC" sel = sel + WhereClause + OrderClause ElseIf strSearchFieldValue = "" And strTestMode = "ON" And strDate <> "" Then sel = "" sel = sel & "SELECT TOP 100 PERCENT Since, WorkFlow_Step, " sel = sel & "Started_By, Client_Fullname, Product_Desc, " sel = sel & "Branch_List, Event_AssignedID, DaysElapsed, Status, " sel = sel & "Instance_ID, Seq_ID, Form_Code " sel = sel & " FROM A02W01ViewDistinct " Dim WhereClause As String Dim OrderClause As String WhereClause = " WHERE Event_IsLatest = 1" 'Display everything for Admin ' Comment below code 'If strUserID <> "Admin" Then WhereClause = WhereClause + " AND WF_Start_UserID like " + "'" + strUserID + "'" OrderClause = " ORDER BY YEAR(Since) DESC, MONTH(Since) DESC, DAY(Since) DESC" sel = sel + WhereClause + OrderClause End If End If Dim da As SqlDataAdapter = New SqlDataAdapter(sel, conn) Dim ds As DataSet = New DataSet() Try conn.Open() da.Fill(ds, "odsA02_Tracking") conn.Close() Catch e As SqlException WFClassLib.PageError() Finally conn.Close() End Try If ds.Tables("odsA02_Tracking") IsNot Nothing Then _ Return ds.Tables("odsA02_Tracking") 'Return ds 'If ds.Tables("odsA02_Tracking") Is Nothing Then Return Nothing 'End If End Function BorderStyle="Outset" CellPadding="4" DataSourceID="odsA02_Tracking" ForeColor="#333333" GridLines="Vertical" Style="border-right: #0000ff thin solid; table-layout: auto; border-top: #0000ff thin solid; font-size: x-small; border-left: #0000ff thin solid; border-bottom: #0000ff thin solid; font-family: Arial; border-collapse: separate" Font-Size="Small" PageSize="30" <Columns> <asp:CommandField ShowSelectButton="True" /> <asp:boundfield datafield="Since" HeaderText="Submit Date" ReadOnly=True SortExpression="Since" /> <asp:BoundField DataField="Started_By" HeaderText="Submitted By" SortExpression="Started_By" /> <asp:BoundField DataField="Client_FullName" HeaderText="Client Name" ReadOnly="True" SortExpression="Client_FullName" /> <asp:BoundField DataField="Product_Desc" HeaderText="Product" ReadOnly="True" SortExpression="Product_Desc" /> <asp:BoundField DataField="Branch_List" HeaderText="Branch" ReadOnly="True" SortExpression="Branch_List" /> <asp:BoundField DataField="Event_AssignedID" HeaderText="Assigned To" ReadOnly="True" SortExpression="Event_AssignedID" /> <asp:BoundField DataField="DaysElapsed" HeaderText="Days Open" ReadOnly="True" SortExpression="DaysElapsed" /> <asp:BoundField DataField="Status" HeaderText="Status" SortExpression="Status" /> <asp:TemplateField> <ItemTemplate> <asp:HiddenField ID=hdnInstanceID Value='<%#Eval("Instance_ID") %>' runat=server> </asp:HiddenField> </ItemTemplate> </asp:TemplateField> <asp:TemplateField> <ItemTemplate> <asp:HiddenField ID=hdnSeqID Value='<%#Eval("Seq_ID") %>' runat=server/> </ItemTemplate> </asp:TemplateField> <asp:TemplateField> <ItemTemplate> <asp:HiddenField ID=hdnFormCode Value='<%#Eval("Form_Code") %>' runat=server/> </ItemTemplate> </asp:TemplateField> </Columns> </asp:GridView> &nbsp;&nbsp; <asp:Label ID="lblMsg" runat="server" Style="font-size: small; color: red; font-family: Arial" Width="525px" Font-Bold="True"></asp:Label><br /> <br /> <asp:Button ID="btnReturn" runat="server" Text="Return" /><br /> <br /> <asp:Label ID="lbltxtUserID" runat="server" Text="txtUserID" Visible="False"></asp:Label> <asp:TextBox ID="txtUserID" runat="server" Visible="False" Width="226px"></asp:TextBox><br /> <asp:Label ID="label4" runat="server" Text="TestModeOn" Visible="false"></asp:Label> <asp:TextBox ID="TestModeOn" runat="server" Visible="False" Width="226px"></asp:TextBox><br /> <br /> <asp:Label ID="lblSearchUserEntered" runat="server" Visible="false" Text="searchText" ></asp:Label> <asp:TextBox ID="searchText" runat="server" Visible="False" Width ="226px" ></asp:TextBox> <br /> <asp:Label ID="Label1" runat="server" Text="txtInstance_ID" Visible="False"></asp:Label> <asp:TextBox ID="txtInstance_ID" runat="server" Visible="False" Width="226px"></asp:TextBox><br /> <asp:Label ID="Label2" runat="server" Text="txtSeq_ID" Visible="False"></asp:Label> <asp:TextBox ID="txtSeq_ID" runat="server" Visible="False" Width="226px"></asp:TextBox><br /> <asp:Label ID="Label3" runat="server" Text="txtForm_Code" Visible="False"></asp:Label> <asp:TextBox ID="txtForm_Code" runat="server" Visible="False" Width="226px"></asp:TextBox><br /> <br /> <asp:Label ID="lblSince" runat="server" Visible="false" Text="Since" ></asp:Label> <asp:TextBox ID="SortSince" runat="server" Visible="False" Width ="226px" ></asp:TextBox> <br /> <br /> <asp:ObjectDataSource ID="odsA02_Tracking" runat="server" OldValuesParameterFormatString="original_{0}" SelectMethod="A02WF01_AdminView" TypeName="WFA02DataObjects"> <SelectParameters> <asp:ControlParameter ControlID="txtUserID" Name="strUserID" PropertyName="Text" Type="String" /> <asp:ControlParameter ControlID="TestModeOn" Name="strTestMode" PropertyName="Text" Type="String" /> <asp:ControlParameter ControlID="searchText" Name="strSearchFieldValue" PropertyName="Text" Type="String" /> <asp:ControlParameter ControlID="SortSince" Name="strDate" PropertyName="Text" Type="String" /> </SelectParameters> </asp:ObjectDataSource> </div> </form>

    Read the article

  • Classify data (cell array) based on years in MATLAB

    - by user2991243
    Suppose that we have this cell array of data : a={43 432 2006; 254 12 2008; 65 35 2000; 64 34 2000; 23 23 2006; 64 2 2010; 32 5 2006; 22 2 2010} Last column of this cell array is years. I want classify data(rows) based on years like this : a_2006 = {43 432 2006; 32 5 2006; 32 5 2006} a_2008 = {254 12 2008}; a_2000 = {65 35 2000; 64 34 2000} a_2010 = {64 2 2010; 22 2 2010} I have different years in column three in every cell array (this cell array is a sample) so I want an automatic method to determine the years and classify them to a_yearA , a_yearB etc. or other naming that I can distinguish years and call data years easily. How can I do this? Thanks.da

    Read the article

  • Button text loses allignment after clicking

    - by breathe0
    Strange things happen. I have a 4x4 button table layout, which is the following: <TableLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_below="@+id/cerca"> <TableRow android:layout_width = "fill_parent" android:layout_height = "wrap_content"> <Button android:id = "@+id/btn1" android:layout_width = "wrap_content" android:layout_height = "wrap_content" android:layout_weight="1" android:text = "Scarica POI da server" android:onClick="downloadFromServer" /> <Button android:id = "@+id/btn2" android:layout_width = "wrap_content" android:layout_height = "wrap_content" android:layout_weight="1" android:text = "Aggiungi POI" android:onClick="goCreatePOI" /> </TableRow> <TableRow android:layout_width = "fill_parent" android:layout_height = "wrap_content"> <Button android:id = "@+id/btn3" android:layout_width = "wrap_content" android:layout_height = "wrap_content" android:layout_weight="1" android:text = "Rimuovi i POI del server" android:onClick="removeServerPOI" /> <Button android:id = "@+id/btn4" android:layout_width = "wrap_content" android:layout_height = "wrap_content" android:layout_weight="1" android:text = "Rimuovi i POI personali" android:onClick="removePersonalPOI" /> </TableRow> </TableLayout> This table layout is nested inside a relative layout, which is nested in a scrollview. Now, whenever i click on one of them, everytime the text inside the button change allignment: if before clicking was centered and displayed on two lines, after the click it loses its alignment and is displayed only in one row (cutting off some part of the text). Am I doing something wrong, or maybe it's a bug?

    Read the article

  • Deleting an option in a <select> list

    - by Tyzak
    hello, i have following function: function delete_auswahl() { var anzahl =document.getElementById ("warenkorbfeld").length ; for (var i =0; i<=anzahl; i++) { if (document.getElementById ("warenkorbfeld").options[i].selected==true) { if (document.getElementById ("warenkorbfeld").options[i].id == "Margherita" ) gesamtbetrag = gesamtbetrag - 4; if (document.getElementById ("warenkorbfeld").options[i].id=="Salami" ) gesamtbetrag = gesamtbetrag - 4.50; if (document.getElementById ("warenkorbfeld").options[i].id=="Hawaii" ) gesamtbetrag = gesamtbetrag - 5.50; document.getElementById ("warenkorbfeld").options[i]=null; i--;// auf der gleichen stelle bleiben, da dass nächste feld nachrückt } } document.getElementById('gesamtbetrag').innerHTML=gesamtbetrag ; } before i added values with function hinzu (pizza) { NeuerEintrag = new Option(pizza, pizza, false, false); document.getElementById("warenkorbfeld").options[document.getElementById("warenkorbfeld").length] = NeuerEintrag ; if (pizza=="Margherita") { gesamtbetrag = gesamtbetrag + 4; } if (pizza=="Salami") { gesamtbetrag = gesamtbetrag + 4.50; } if (pizza=="Hawaii") { gesamtbetrag = gesamtbetrag + 5.50; } document.getElementById('gesamtbetrag').innerHTML=gesamtbetrag ; } now, in the delete function doesn't substract the price. despite this, all works. what's wrong with this term? if (document.getElementById ("warenkorbfeld").options[i].id == "Margherita" ) gesamtbetrag = gesamtbetrag - 4; thanks in advance

    Read the article

  • minimal cover for functional dependencies

    - by user2975836
    I have the following problem: AB -> CD H->B G ->DA CD-> EF A -> HJ J>G I understand the first step (break down right hand side) and get the following results: AB -> C AB -> D H -> B G -> D G -> A CD -> E CD -> F A -> H A -> J J -> G I understand that A - h and h - b, therefore I can remove the B from AB - c and ab - D, to get: A -> C A -> D H -> B G -> D G -> A CD -> E CD -> F A -> H A -> J J -> G The step that follows is what I can't compute (reduce the left hand side) Any help will be greatly appreciated.

    Read the article

  • How to automatically select the selected item in list menu after submitting the form?

    - by SzamDev
    Hi I have this code : <form id="form2" name="form2" method="post" action=""> <table dir="ltr" width="554" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td width="269" class="da"><div align="center"><span id="spryselect1"> <select onchange="form2.submit()" name="mpage" id="mpage"> <option selected="selected" value="no">-----------</option> <option value="medmo">Medmo.com</option> <option value="paris">Paris.com</option> <option value="imo">IMO.com</option> </select> </span></div></td> <td width="214" class="t_b">Select Website</td> </tr> </table> </form> When the user select a value, the form will automatically submit, I want the item that the user has selected to be selected after submitting the form. Because I am facing this proplem: The user select the first item (Medmo.com) - form submit - selected item will be "-------" I want this to happen : The user select the first item (Medmo.com) - form submit - selected item will be "Medmo.com" How I can do that? Thanks in Advance.

    Read the article

  • Pointer inside a struct / thread

    - by bruno
    Hi! I have this warning "warning: assignment from incompatible pointer type " in this line: data1->transformed_block[l] = &transformed_block[l]; - void print_message_function ( void *ptr ) { dt *data; data = (dt *) ptr; printf("Dentro da thread Numero0: %ld\n", data->L_norm_NewBlock); pthread_exit(0); } typedef struct data_thread { long L_norm_NewBlock; int Bsize_X; int Bsize_Y; int *transformed_block[MAX_LEVEL]; long L_norm_OrigBlock; } dt; void function() { int *transformed_block[MAX_LEVEL]; pthread_t thread1; dt *data1; pthread_attr_t attr; pthread_attr_init(&attr); //Fills structure data1 = (dt *) malloc(sizeof(dt)); data1->transformed_block[l] = &transformed_block[l]; data1->L_norm_NewBlock=0; data1->Bsize_Y = Bsize_Y; data1->Bsize_X = Bsize_X; pthread_create(&thread1, &attr, (void *) &print_message_function, (void *) &data1); } I want to get rid of that warning, and the values i get inside the thread are wrong. For example data1-L_norm_NewBlock=0; in the thread guives me a differente value (not 0 like it should be).

    Read the article

  • Repeated host lookups failing in urllib2

    - by reve_etrange
    I have code which issues many HTTP GET requests using Python's urllib2, in several threads, writing the responses into files (one per thread). During execution, it looks like many of the host lookups fail (causing a name or service unknown error, see appended error log for an example). Is this due to a flaky DNS service? Is it bad practice to rely on DNS caching, if the host name isn't changing? I.e. should a single lookup's result be passed into the urlopen? Exception in thread Thread-16: Traceback (most recent call last): File "/usr/lib/python2.6/threading.py", line 532, in __bootstrap_inner self.run() File "/home/da/local/bin/ThreadedDownloader.py", line 61, in run page = urllib2.urlopen(url) # get the page File "/usr/lib/python2.6/urllib2.py", line 126, in urlopen return _opener.open(url, data, timeout) File "/usr/lib/python2.6/urllib2.py", line 391, in open response = self._open(req, data) File "/usr/lib/python2.6/urllib2.py", line 409, in _open '_open', req) File "/usr/lib/python2.6/urllib2.py", line 369, in _call_chain result = func(*args) File "/usr/lib/python2.6/urllib2.py", line 1170, in http_open return self.do_open(httplib.HTTPConnection, req) File "/usr/lib/python2.6/urllib2.py", line 1145, in do_open raise URLError(err) URLError: <urlopen error [Errno -2] Name or service not known>

    Read the article

  • [Wireless LAN]hostapd is giving error whwn running in target board

    - by Renjith G
    hi, I got the following error when i tried to run the hostapd command in my target board. Any idea about this? /etc # hostapd -dd hostapd.conf Configuration file: hostapd.conf madwifi_set_iface_flags: dev_up=0 madwifi_set_privacy: enabled=0 BSS count 1, BSSID mask ff:ff:ff:ff:ff:ff (0 bits) Flushing old station entries madwifi_sta_deauth: addr=ff:ff:ff:ff:ff:ff reason_code=3 ioctl[IEEE80211_IOCTL_SETMLME]: Invalid argument madwifi_sta_deauth: Failed to deauth STA (addr ff:ff:ff:ff:ff:ff reason 3) Could not connect to kernel driver. Deauthenticate all stations madwifi_sta_deauth: addr=ff:ff:ff:ff:ff:ff reason_code=2 ioctl[IEEE80211_IOCTL_SETMLME]: Invalid argument madwifi_sta_deauth: Failed to deauth STA (addr ff:ff:ff:ff:ff:ff reason 2) madwifi_set_privacy: enabled=0 madwifi_del_key: addr=00:00:00:00:00:00 key_idx=0 madwifi_del_key: addr=00:00:00:00:00:00 key_idx=1 madwifi_del_key: addr=00:00:00:00:00:00 key_idx=2 madwifi_del_key: addr=00:00:00:00:00:00 key_idx=3 Using interface ath0 with hwaddr 00:0b:6b:33:8c:30 and ssid '"RG_WLAN Testing Renjith G"' SSID - hexdump_ascii(len=27): 22 52 47 5f 57 4c 41 4e 20 54 65 73 74 69 6e 67 "RG_WLAN Testing 20 52 65 6e 6a 69 74 68 20 47 22 Renjith G" PSK (ASCII passphrase) - hexdump_ascii(len=12): 6d 79 70 61 73 73 70 68 72 61 73 65 mypassphrase PSK (from passphrase) - hexdump(len=32): 70 6f a6 92 da 9c a8 3b ff 36 85 76 f3 11 9c 5e 5d 4a 4b 79 f4 4e 18 f6 b1 b8 09 af 6c 9c 6c 21 madwifi_set_ieee8021x: enabled=1 madwifi_configure_wpa: group key cipher=1 madwifi_configure_wpa: pairwise key ciphers=0xa madwifi_configure_wpa: key management algorithms=0x2 madwifi_configure_wpa: rsn capabilities=0x0 madwifi_configure_wpa: enable WPA=0x1 WPA: group state machine entering state GTK_INIT (VLAN-ID 0) GMK - hexdump(len=32): [REMOVED] GTK - hexdump(len=32): [REMOVED] WPA: group state machine entering state SETKEYSDONE (VLAN-ID 0) madwifi_set_key: alg=TKIP addr=00:00:00:00:00:00 key_idx=1 madwifi_set_privacy: enabled=1 madwifi_set_iface_flags: dev_up=1 ath0: Setup of interface done. l2_packet_receive - recvfrom: Network is down Wireless event: cmd=0x8b1a len=40 Register Fail Register Fail WPA: group state machine entering state SETKEYS (VLAN-ID 0) GMK - hexdump(len=32): [REMOVED] GTK - hexdump(len=32): [REMOVED] wpa_group_setkeys: GKeyDoneStations=0 WPA: group state machine entering state SETKEYSDONE (VLAN-ID 0) madwifi_set_key: alg=TKIP addr=00:00:00:00:00:00 key_idx=2 Signal 2 received - terminating Flushing old station entries madwifi_sta_deauth: addr=ff:ff:ff:ff:ff:ff reason_code=3 ioctl[IEEE80211_IOCTL_SETMLME]: Invalid argument madwifi_sta_deauth: Failed to deauth STA (addr ff:ff:ff:ff:ff:ff reason 3) Could not connect to kernel driver. Deauthenticate all stations madwifi_sta_deauth: addr=ff:ff:ff:ff:ff:ff reason_code=2 ioctl[IEEE80211_IOCTL_SETMLME]: Invalid argument madwifi_sta_deauth: Failed to deauth STA (addr ff:ff:ff:ff:ff:ff reason 2) madwifi_set_privacy: enabled=0 madwifi_set_ieee8021x: enabled=0 madwifi_set_iface_flags: dev_up=0

    Read the article

  • Cannot run a VM with more than three network interfaces with KVM

    - by Bostonvaulter
    I'm running KVM on top of Ubuntu 10.10 Server I can create VM's (Virtual Machine) and network interfaces fine but I cannot seem to add more than three network interfaces. As soon as I have a VM with four network interfaces it gets stuck on startup at the starting SeaBIOS page with this message: Starting SeaBIOS (version pre-0.6.1-20100702_143500-palmer) So far I've verified this with two VM's, a Ubuntu 10.10 desktop and a Vyatta router. The specific network hardware I assign to the VM's doesn't seem to matter. I'm trying to have one bridged interface and three private networks using Vyatta to route between them. Does anyone know why I can't run a VM with more than three network interfaces? Edit: Additionally the KVM thread responsible for the specific VM hangs using ~100% CPU (i.e. one core). Here's the command for the process that is hanging: /usr/bin/kvm -S -M pc-0.12 -enable-kvm -m 512 -smp 1,sockets=1,cores=1,threads=1 -name vyatta -uuid 6dff7c94-6810-423e-5fea-fec10da0e9b7 -nodefaults -chardev socket,id=monitor,path=/var/lib/libvirt/qemu/vyatta.monitor,server,nowait -mon chardev=monitor,mode=readline -rtc base=utc -boot c -drive file=/home/rams/virtual-machines/vyatta.img,if=none,id=drive-ide0-0-0,boot=on,format=raw -device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 -drive if=none,media=cdrom,id=drive-ide0-1-0,readonly=on,format=raw -device ide-drive,bus=ide.1,unit=0,drive=drive-ide0-1-0,id=ide0-1-0 -device rtl8139,vlan=0,id=net0,mac=00:54:00:be:cc:4b,bus=pci.0,addr=0x3 -net tap,fd=97,vlan=0,name=hostnet0 -device rtl8139,vlan=1,id=net1,mac=52:54:00:da:59:ed,bus=pci.0,addr=0x5 -net tap,fd=98,vlan=1,name=hostnet1 -device rtl8139,vlan=2,id=net2,mac=52:54:00:ce:22:b6,bus=pci.0,addr=0x6 -net tap,fd=99,vlan=2,name=hostnet2 -device rtl8139,vlan=3,id=net3,mac=52:54:00:1e:bc:46,bus=pci.0,addr=0x7 -net tap,fd=101,vlan=3,name=hostnet3 -chardev pty,id=serial0 -device isa-serial,chardev=serial0 -usb -vnc 127.0.0.1:0 -k en-us -vga cirrus -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x4 Edit: I've also found an error in dmesg that might be related (it also shows up when running virtd in verbose mode): 14:47:24.399: warning : qemudParsePCIDeviceStrs:1422 : Unexpected exit status '1', qemu probably failed I've also tried disabling app armor but that doesn't seem to make a difference.

    Read the article

< Previous Page | 16 17 18 19 20 21 22 23 24 25  | Next Page >