Search Results

Search found 50 results on 2 pages for 'nir'.

Page 2/2 | < Previous Page | 1 2 

  • C# Gridview - Checking if a column already exists when adding a new column fails

    - by Nir
    I have a GridView with 10 columns. On a certain condition, I want to add a new column called "Expiration Date". The problem is that when the user presses "Search" again (Postback) the column is added again. I check before adding the column, to see if it already exists: BoundField dtExp = new BoundField {DataField = "DateTimeExpired", HeaderText = "Expiration Date", DataFormatString = "{0:d}"}; if (!grid.Columns.Contains(dtExp)){grid.Columns.Add(dtExp);} But the problem is that even if the column already exists, "Contains" returns false. What am I doing wrong? Thanks!

    Read the article

  • mysql fulltext search as level2 index

    - by Nir
    lets say I have a table with product details. one of the fields is category (integer). I want to do fulltext search on product name in specific category. Unfortunately Mysql does not allow me to specify index that includes category and product name as fulltext. It looks like I can use fulltext only on product_name and theefore any fulltext search will search product names in all categories. Is there any way to solve this (allow fulltext search/index only on products in category)?

    Read the article

  • Private JQuery instance

    - by Nir Levy
    We are writing a SaaS like solution that requires our customers to SCRIPT SRC some javascript code we are building (think Google Analytics scenario). We would like to use JQuery. However, since our customers might already have conflicting JQuery versions or other conflicting frameworks (prototype.js for one) we cannot tell them to source jquery.js. We were thinking of coping the jquery source as to create a 'private' jquery instance and simple search/replace the JQuery and $ functions with myJQuery and $J Is there any reason for this not to work? has anyone tried something like this? What can we do about plugins?

    Read the article

  • Mysql SET NAMES UTF8 - how to get rid of?

    - by Nir
    In a very busy PHP script we have a call at the beginning to "Set names utf8" which is setting the character set in which mysql should interpret and send the data back from the server to the client. http://dev.mysql.com/doc/refman/5.0/en/charset-applications.html I want to get rid of it so I set default-character-set=utf8 In our server ini file. (see link above) The setting seems to be working since the relevant server parameters are : 'character_set_client', 'utf8' 'character_set_connection', 'utf8' 'character_set_database', 'latin1' 'character_set_filesystem', 'binary' 'character_set_results', 'utf8' 'character_set_server', 'latin1' 'character_set_system', 'utf8' But after this change and commenting out set names utf8 call still the data starts to come out garbled. Please advise....

    Read the article

  • MySQL: Is it faster to use inserts and updates instead of insert on duplicate key update?

    - by Nir
    I have a cron job that updates a large number of rows in a database. Some of the rows are new and therefore inserted and some are updates of existing ones and therefore update. I use insert on duplicate key update for the whole data and get it done in one call. But- I actually know which rows are new and which are updated so I can also do inserts and updates seperately. Will seperating the inserts and updates have advantage in terms of performance? What are the mechanics behind this ? Thanks!

    Read the article

  • SQL update fields of one table from fields of another one.

    - by Nir
    I'm having two tables: A [ID, column1, column2, column3] B [ID, column1, column2, column3, column4] A table will always be subset of B table (meaning all columns of A are also in B). I want to update a record with a specific ID in B with their data from A for all columns of A. This ID exists both in A and B. Is there an UPDATE syntax or any other way to do that without specifying the column names, just saying "set all columns of A"? I'm using postgresql, so a specific non-standard command is also accepted (however, not preferred). Thanks.

    Read the article

  • Script tag in ASPX page is written partially (output stopped at random)

    - by Nir
    I have an aspx page where I put a script tag with .net "if" and "else". The problem is that the output gets cut at random points each time. Sometimes it's ok, sometimes I get cropped output. The code itself (Simplified example): <body id="body" runat="server"> <form id="form1" runat="server">some HTML <script type="text/javascript"> window.addEvent('domready', function() { var x = "nothing"; <% if(someCondition){%> x = "2"; <%} else {%> x = "3"; <%}%> }); </script> </form> </body> The cropped output: <body id="body" runat="server"> <form id="form1" runat="server">some HTML <script type="text/javascript"> window.addEvent('domready', function() { var x = "nothi </script> </form> </body> Does anybody have a clue?

    Read the article

  • C# Running several tasks at different intervals

    - by Nir
    A design question: I'd like to build a Windows service that executes different commands at different intervals. For simplicity's sake, let's say I want to run some batch files. The input it gets is a list of files and the intervals at which to execute. For example: a.bat - 4 minutes b.bat - 1 minute c.bat - 1 minute d.bat - 2 minutes I was thinking about sorting them according to intervals, and then setting a timer for each of the intervals. I'm not sure this is the best solution and I'd be happy to hear some feedbacks. Thanks!

    Read the article

  • Including a minified js code in another js library

    - by Nir
    I want to incorporate a minified javascript library (for example http://sizzlejs.com/) into my own non minified javascript library. The reason is that my library plugs into other websites and I don't want to ask them to include the extra library (sizzle) as well. Is there a way to include a minified library in a non minified library and have them both in one js file?

    Read the article

  • C#: Changing the order of columns when binding DataTable to a GridView

    - by Nir
    How is it possible to change the displayed order of columns from a DataTable? For example, dataTable "dt" contains two columns "a" and "b". I bind it to a GridView like this: gridView.DataSource = dt; gridView.DataBind(); But I'd like the GridView to display "b" first (leftmost). Important point: I'm using this to export to Excel and there's no actual output to screen, using: HtmlTextWriter htw = new HtmlTextWriter(sw); gridView.RenderControl(htw); Thanks!

    Read the article

  • C# 3.5: Dynamically adding classes without recompiling

    - by Nir
    I'd like to build an infrastructure that will monitor a server and check ping, response time, and more. The catch is that future checks (for example: does a certain file exist) will be added without recompiling the infrastructure. How do I build it in such a way that will enable me to attach inherited classes with different functionality, and execute them without recompiling? Thanks!

    Read the article

  • C# Sending cookie in an HttpWebRequest which is redirected

    - by Nir
    I'm looking for a way to work with an API which requires login, and then redirects to another URL. The thing is that so far I've only come up with a way to make 2 Http Requests for each action I want to do: first, get cookie with AllowRedirect=false, then get the actual URI and do a second request with the cookie: HttpWebRequest request = (HttpWebRequest)WebRequest.Create(sUrl); request.AllowAutoRedirect = false; HttpWebResponse response = (HttpWebResponse)request.GetResponse(); string redirectedUrl = response.Headers["Location"]; if (!String.IsNullOrEmpty(redirectedUrl)) { redirectedUrl = "http://www.ApiUrlComesHere.com/" + redirectedUrl; HttpWebRequest authenticatedRequest = (HttpWebRequest)WebRequest.Create(redirectedUrl); authenticatedRequest.Headers["Cookie"] = response.Headers["Set-Cookie"]; response = (HttpWebResponse)request.GetResponse(); } It seems terribly inefficient. Is there another way? Thanks!

    Read the article

  • getAttribute cannot return class in IE7?

    - by Nir
    I need to find random nodes according to random attribute values. To do that I use getAtrribute on nodes from getElementsByTagName. It seems like when I look for class name as attribute it does not work on IE (works on FF). Anyone know if getAtrribute doesn't work only on 'class' or other attributes as well? (if its only class I'll do a workaround.)

    Read the article

  • Parsing XHTML results from Bing

    - by Nir
    Hello, i am trying to parse received search queries from bing search engines which are received in xhtml in java. I am using sax XmlReader to read the results but i keep on getting errors. here is my code-this one is for the hadler of the reader: import org.xml.sax.Attributes; import org.xml.sax.SAXException; import org.xml.sax.helpers.DefaultHandler; public class XHTMLHandler extends DefaultHandler{ public XHTMLHandler() { super(); } public void startDocument () { System.out.println("Start document"); } public void endDocument () { System.out.println("End document"); } public void startElement (String uri, String name,String qName, Attributes atts) { if ("".equals (uri)) System.out.println("Start element: " + qName); else System.out.println("Start element: {" + uri + "}" + name); } public void endElement (String uri, String name, String qName) { if ("".equals (uri)) System.out.println("End element: " + qName); else System.out.println("End element: {" + uri + "}" + name); } public void startPrefixMapping (String prefix, String uri) throws SAXException { } public void endPrefixMapping (String prefix) throws SAXException { } public void characters (char ch[], int start, int length) { System.out.print("Characters: \""); for (int i = start; i < start + length; i++) { switch (ch[i]) { case '\\': System.out.print("\\\\"); break; case '"': System.out.print("\\\""); break; case '\n': System.out.print("\\n"); break; case '\r': System.out.print("\\r"); break; case '\t': System.out.print("\\t"); break; default: System.out.print(ch[i]); break; } } System.out.print("\"\n"); } } and this is the program itself: import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.net.HttpRetryException; import java.net.HttpURLConnection; import java.net.URL; import org.xml.sax.InputSource; import org.xml.sax.SAXException; import org.xml.sax.XMLReader; import org.xml.sax.helpers.XMLReaderFactory; public class Searching { private String m_urlBingSearch = "http://www.bing.com/search?q="; private HttpURLConnection m_httpCon; private OutputStreamWriter m_streamWriter; //private BufferedReader m_bufferReader; private URL m_serverAdress; private StringBuilder sb; private String m_line; private InputSource m_inputSrc; public Searching() { m_httpCon = null; m_streamWriter = null; //m_bufferReader = null; m_serverAdress = null; sb = null; m_line = new String(); } public void SearchBing(String searchPrms) throws SAXException,IOException { //set up connection sb = new StringBuilder(); sb.append(m_urlBingSearch); sb.append(searchPrms); m_serverAdress = new URL(sb.toString()); m_httpCon = (HttpURLConnection)m_serverAdress.openConnection(); m_httpCon.setRequestMethod("GET"); m_httpCon.setDoOutput(true); m_httpCon.setConnectTimeout(10000); m_httpCon.connect(); //m_streamWriter = new OutputStreamWriter(m_httpCon.getOutputStream()); //m_bufferReader = new BufferedReader(new InputStreamReader(m_httpCon.getInputStream())); XMLReader reader = XMLReaderFactory.createXMLReader(); XHTMLHandler handle = new XHTMLHandler(); reader.setContentHandler(handle); reader.setErrorHandler(handle); //reader.startPrefixMapping("html", "http://www.w3.org/1999/xhtml"); handle.startPrefixMapping("html", "http://www.w3.org/1999/xhtml"); m_inputSrc = new InputSource(m_httpCon.getInputStream()); reader.parse(m_inputSrc); m_httpCon.disconnect(); } public static void main(String [] args) throws SAXException,IOException { Searching s = new Searching(); s.SearchBing("beatles"); } } this is my error message: Exception in thread "main" java.io.IOException: Server returned HTTP response code: 503 for URL: http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source) at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.setupCurrentEntity(Unknown Source) at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.startEntity(Unknown Source) at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.startDTDEntity(Unknown Source) at com.sun.org.apache.xerces.internal.impl.XMLDTDScannerImpl.setInputSource(Unknown Source) at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$DTDDriver.dispatch(Unknown Source) at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$DTDDriver.next(Unknown Source) at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(Unknown Source) at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(Unknown Source) at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(Unknown Source) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source) at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source) at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source) at Searching.SearchBing(Searching.java:57) at Searching.main(Searching.java:65) can someone please help? i think it has something to do with dtd but i don't know hot to fix it

    Read the article

  • Getting the full-name of the current user, returns an empty string (C#/C++)

    - by Nir
    I try to get the full-name of the current log-in user (Fullname, not username). The following code C#, C++ works fine but on XP computers not connected to the Net, I get empty string as result if I run it ~20 minutes after login (It runs OK whithin the first ~20 minutes after login) A Win32 API (GetUserNameEx) is used rather that PrincipalContext since it PrincipalContext may takes up to 15 seconds when working offline. Any Help why am I getting an empty string as result though a user full name is specified??? - C# Code public static string CurrentUserFullName { get { const int EXTENDED_NAME_FORMAT_NAME_DISPLAY = 3; StringBuilder userName = new StringBuilder(256); uint length = (uint) userName.Capacity; string ret; if (GetUserNameEx(EXTENDED_NAME_FORMAT_NAME_DISPLAY, userName, ref length)) { ret = userName.ToString(); } else { int errorCode = Marshal.GetLastWin32Error(); throw new Win32Exception("GetUserNameEx Failed. Error code - " + errorCode); } return ret; } } [DllImport("Secur32.dll", CharSet = CharSet.Auto, SetLastError = true)] private static extern bool GetUserNameEx(int nameFormat, StringBuilder lpNameBuffer, ref uint lpnSize); - Code in C++ #include "stdafx.h" #include <windows.h> #define SECURITY_WIN32 #include <Security.h> #pragma comment( lib, "Secur32.lib" ) int _tmain(int argc, _TCHAR* argv[]) { char szName[100]; ULONG nChars = sizeof( szName ); if ( GetUserNameEx( NameDisplay, szName, &nChars ) ) { printf( "Name: %s\n", szName); } else { printf( "Failed to GetUserNameEx\n" ); printf( "%d\n", GetLastError() ); } return 0; }

    Read the article

  • How to find root cause for "too many connections" error in MySQL/PHP

    - by Nir
    I'm running a web service which runs algorithms that serve millions of calls daily and run some background processing as well. Every now and than I see "Too many connections" error in attempts to connect to the MySQL box" for a few seconds. However this is not necessarily attributed to high traffic times or anything I can put my finger on. I want to find the bottleneck causing it. Other than in the specific times this happens the server isn't too loaded in terms of CPU and Memory, and has 2-3 connections (threads) open and everything works smoothly. (I use Zabbix for monitoring) Any creative ideas on how to trace it?

    Read the article

  • Calling applescript from shell script using admin previleges

    - by Nir
    I'm running a shell script that runs an installation program (by ViseX) and selects different items in the installer through a list. The installer needs administrator privileges to run properly, but I don't want to use sudo. Here's the applescript I'm using: osascript <<-END tell application "$1" with timeout of 8 * 3600 seconds activate Select "$2" DoInstall end timeout end tell END

    Read the article

  • Input In Java- How does it work?

    - by Nir Avnon
    Hey guys, with a lot of help from you i was managed to write this nice code (I'm new in it, so kind of exciting.. :) ) And still I have not understand how can I input this code. first of all, I get an this error in the console line (I'm using Eclipse): Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0 at NumberConverter.main(NumberConverter.java:5). What does that mean? I just want to chack whether it works, and I can't call the function/program any how. I used to call in an "old fashion way", like in scheme, to the function that I wrote and see if something happens. How does it work in java? Do we call the program itself? function? what and where do we write? -I want to chack if it works, doesn't matter how, and I'll be glad to know how can I plugin input. Thank you so much! public class NumberConverter{ public static void main(String[] args) { int i = Integer.parseInt(args[0]); toBinary(i); toOctal(i); toHex(i); } public static void toBinary(int int1){ System.out.println(int1 + " in binary is"); System.out.println(Integer.toBinaryString(int1)); } public static void toOctal(int int1){ System.out.println(int1 + " in octal is"); System.out.println(Integer.toOctalString(int1)); } public static void toHex(int int1){ System.out.println(int1 + " in hex is"); System.out.println(Integer.toHexString(int1)); } }

    Read the article

  • C# - Inserting and Removing from Cache

    - by Nir
    1 - If I insert to Cache by assigning the value: Cache["key"] = value; what's the expiration time? 2 - Removing the same value from Cache: I want to check if the value is in Cache by if(Cache["key"]!=null), is it better to remove it from Cache by Cache.Remove("key") or Cache["key"]=null ?

    Read the article

  • set timeout to http response read method in python

    - by nirtayeb
    Hi, I'm building a download manager in python for fun, and sometimes the connection to the server is still on but the server doesn't send me data, so read method (of HTTPResponse) block me forever. This happens, for example, when I download from a server, which located outside of my country, that limit the bandwidth to other countries. How can I set a timeout for the read method (2 minutes for example)? Thanks, Nir.

    Read the article

  • Entity Framework - Condition on one to many join (Lambda)

    - by nirpi
    Hi, I have 2 entities: Customer & Account, where a customer can have multiple accounts. On the account, I have a "PlatformTypeId" field, which I need to condition on (multiple values), among other criterions. I'm using Lambda expressions, to build the query. Here's a snippet: var customerQuery = (from c in context.CustomerSet.Include("Accounts") select c); if (criterions.UserTypes != null && criterions.UserTypes.Count() > 0) { List<short> searchCriterionsUserTypes = criterions.UserTypes.Select(i => (short)i).ToList(); customerQuery = customerQuery.Where(CommonDataObjects.LinqTools.BuildContainsExpression<Customer, short>(c => c.UserTypeId, searchCriterionsUserTypes)); } // Other criterions, including the problematic platforms condition (below) var customers = customerQuery.ToList(); I can't figure out how to build the accounts' platforms condition: if (criterions.Platforms != null && criterions.Platforms.Count() > 0) { List<short> searchCriterionsPlatforms = criterions.Platforms.Select(i => (short)i).ToList(); customerQuery = customerQuery.Where(c => c.Accounts.Where(LinqTools.BuildContainsExpression<Account, short>(a => a.PlatformTypeId, searchCriterionsPlatforms))); } (The BuildContainsExpression is a method we use to build the expression for the multi-select) I'm getting a compilation error: The type arguments for method 'System.Linq.Enumerable.Where(System.Collections.Generic.IEnumerable, System.Func)' cannot be inferred from the usage. Try specifying the type arguments explicitly. Any idea how to fix this? Thanks, Nir.

    Read the article

  • Display problem after deletion in linked list in C

    - by LuckySlevin
    Hi, actually this was another problem but it changed so I decided to open a new question. My code is typedef struct inner_list { int count; char word[100]; inner_list*next; } inner_list; typedef struct outer_list { char word [100]; inner_list * head; int count; outer_list * next; } outer_list; void delnode(outer_list **head,char num[100])//thanks to both Nir Levy and Jeremy P. { outer_list *temp, *m; m=temp=*head; /*FIX #1*/ while(temp!=NULL) { if(strcmp(temp->word,num)==0) { if(temp==*head) { delinner(temp->head); /* FIX#2 */ *head=temp->next; free(temp); return; } else { delinner(temp->head); /* FIX#2 */ m->next=temp->next; free(temp); return; } } else { m=temp; temp= temp->next; } } printf(" ELEMENT %s NOT FOUND ", num); } void delinner(inner_list *head) { /* FIX#2 */ inner_list *temp; temp=head; while(temp!=NULL) { head=temp->next; free(temp); temp=head; } } void delnode2(outer_list *up,inner_list **head,char num[100]) { inner_list *temp2,*temp, *m; outer_list *p; p = up; while(p!=NULL){m=temp=temp2=p->head; while(temp!=NULL) { if(strcmp(temp->word,num)==0) { if(temp==(*head)) { *head=temp->next; free(temp); return; } else { m->next=temp->next; free(temp); return; } } else { m=temp; temp= temp->next; } } p=p->next; } printf(" ELEMENT %s NOT FOUND ", num); } void print_node(outer_list *parent_node) { while(parent_node!=NULL){ printf("%s\t%d\t", parent_node->word, parent_node->count); inner_list *child_node = parent_node->head; printf("list: "); if(child_node ==NULL){printf("BUARADA");} while (child_node != NULL) { printf("%s-%d", child_node->word,child_node->count); child_node = child_node->next; if (child_node != NULL) { printf("->"); } } printf("\n"); parent_node = parent_node->next; } } While deleting an element from outer list I am also trying the delete the same element from inner_list too. For example: - Let's say aaa is an element of outer_list linked list and let's point it with outer_list *p - This aaa can also be in an inner_list linked list too. (it can be in p-head or another innerlist.) Now, the tricky part again. I tried to apply the same rules with outer_list deletion but whenever i delete the head element of inner_list it gives an error. Where is the wrong thing in print_node or delnode2?

    Read the article

< Previous Page | 1 2