Daily Archives

Articles indexed Tuesday April 27 2010

Page 11/121 | < Previous Page | 7 8 9 10 11 12 13 14 15 16 17 18  | Next Page >

  • Git ignore deleted files

    - by Petah
    Ok heres my situation. I have a website project that has more than 50,000 unimportant files (to development) in some directories. /website.com/files/1.txt /website.com/files/2.txt /website.com/files/3.txt /website.com/files/etc.txt The stuff in /files is already in the repo. I want to delete all the files in /files on my local copy but I want git to ignore it so it doesn't delete them when I do a pull on the web server. Any ideas?

    Read the article

  • Simple question about C++ constant syntax

    - by WilliamLou
    Here is some code copied from Thinking in C++ Vol1 Chapter 10. #include <iostream> using namespace std; int x = 100; class WithStatic { static int x; static int y; public: void print() const { cout << "WithStatic::x = " << x << endl; cout << "WithStatic::y = " << y << endl; } }; what's the meaning of const for the function print()? Thanks!

    Read the article

  • tcsh `cd` always issues a printout of `$PWD`. How do I disable this?

    - by Ross Rogers
    Someone in IT thought it would be a good idea to modify the default behavior of the command cd in our tcsh environment. As of Monday the "upgraded" version of cd always prints out $PWD after it navigates to the new directory. e.g. % cd ~/ Directory: /nfs/pdx/home/rbroger1 which cd yields no results so it isn't being alias'd. Is there some environment variable or normal tcsh variable that is being set in our setup scripts to produce this output? I don't want to change all my scripts to use a wrappered or alias'd cd. I just want plain ol' cd.

    Read the article

  • jQuery plugin options: required, optional, inaccessible

    - by Trevor Hartman
    I'm curious how to specify options to a jQuery plugin in a way that some are required, some are optionally overridden, and some can't be touched. I started off with the usual: jQuery.fn.plugin = function (options){ var defaults = { username: "", posts:10, api: "http://myapi.com" } var settings = jQuery.extend({}, defaults, options); } Let's say I want username to be required, posts is optional (defaults to 10) and you (you being the user of the plugin) can't change api, even if they try. Ideally, they'd all still be in the same data structure instead of being split into separate objects. Ideas?

    Read the article

  • How to convert a string into a Point?

    - by NateD
    I have a list of strings of the format "x,y". I would like to make them all into Points. The best Point constructor I can find takes two ints. What is the best way in C# to turn "14,42" into new Point(14,42);? I know the Regex for doing that is /(\d+),(\d+)/, but I'm having a hard time turning those two match groups into ints in C#.

    Read the article

  • Time to ignore IDisposable?

    - by Mystagogue
    Certainly we should call Dipose() on IDisposable objects as soon as we don't need them (which is often merely the scope of a "using" statement). If we don't take that precaution then bad things, from subtle to show-stopping, might happen. But what about "the last moment" before process termination? If your IDisposables have not been explicitly disposed by that point in time, isn't it true that it no longer matters? I ask because unmanaged resources, beneath the CLR, are represented by kernel objects - and the win32 process termination will free all unmanaged resources / kernel objects anyway. Said differently, no resources will remain "leaked" after the process terminates (regardless if Dispose() was called on lingering IDisposables). Can anyone think of a case where process termination would still leave a leaked resource, simply because Dispose() was not explicitly called on one or more IDisposables? Please do not misunderstand this question: I am not trying to justify ignoring IDisposables. The question is just technical-theoretical.

    Read the article

  • How to know if a device can be disabled or not?

    - by user326498
    I use the following code to enable/disable a device installed on my computer: SP_PROPCHANGE_PARAMS params; memset(&params, 0, sizeof(params)); devParams.cbSize = sizeof(devParams); params.ClassInstallHeader.cbSize = sizeof(params.ClassInstallHeader); params.ClassInstallHeader.InstallFunction = DIF_PROPERTYCHANGE; params.Scope = DICS_FLAG_GLOBAL; params.StateChange = DICS_DISABLE ; params.HwProfile = 0; // current profile if(!SetupDiSetClassInstallParams(m_hDev, &m_hDevInfo,&params.ClassInstallHeader,sizeof(SP_PROPCHANGE_PARAMS))) { dwErr = GetLastError(); return FALSE; } if(!SetupDiCallClassInstaller(DIF_PROPERTYCHANGE,m_hDev,&m_hDevInfo)) { dwErr = GetLastError(); return FALSE; } return TRUE; This code works perfectly only for those devices that can also be disabled by using Windows Device Manager, and won't work for some un-disabled devices such as my cpu device: Intel(R) Pentium(R) Dual CPU E2160 @ 1.80GHz. So the problem is how to determine if a device can be disabled or not programmatically? Is there any API to realize this goal? Thank you!

    Read the article

  • Count Records Returned MySQL Doctrine

    - by 01010011
    Hi, How do I check the number of records returned from a search of my MySQL database with a statement like this: $searchKey = 'Something to search for'; $searchResults = Doctrine::getTable('TableName')->createQuery('t')- >where('columnName LIKE ?','%'.$searchKey.'%')->execute();

    Read the article

  • HttpWebRequest Timeouts After Ten Consecutive Requests

    - by Bob Mc
    I'm writing a web crawler for a specific site. The application is a VB.Net Windows Forms application that is not using multiple threads - each web request is consecutive. However, after ten successful page retrievals every successive request times out. I have reviewed the similar questions already posted here on SO, and have implemented the recommended techniques into my GetPage routine, shown below: Public Function GetPage(ByVal url As String) As String Dim result As String = String.Empty Dim uri As New Uri(url) Dim sp As ServicePoint = ServicePointManager.FindServicePoint(uri) sp.ConnectionLimit = 100 Dim request As HttpWebRequest = WebRequest.Create(uri) request.KeepAlive = False request.Timeout = 15000 Try Using response As HttpWebResponse = DirectCast(request.GetResponse, HttpWebResponse) Using dataStream As Stream = response.GetResponseStream() Using reader As New StreamReader(dataStream) If response.StatusCode <> HttpStatusCode.OK Then Throw New Exception("Got response status code: " + response.StatusCode) End If result = reader.ReadToEnd() End Using End Using response.Close() End Using Catch ex As Exception Dim msg As String = "Error reading page """ & url & """. " & ex.Message Logger.LogMessage(msg, LogOutputLevel.Diagnostics) End Try Return result End Function Have I missed something? Am I not closing or disposing of an object that should be? It seems strange that it always happens after ten consecutive requests. Notes: In the constructor for the class in which this method resides I have the following: ServicePointManager.DefaultConnectionLimit = 100 If I set KeepAlive to true, the timeouts begin after five requests. All the requests are for pages in the same domain. EDIT I added a delay between each web request of between two and seven seconds so that I do not appear to be "hammering" the site or attempting a DOS attack. However, the problem still occurs.

    Read the article

  • IO Exception: directory name is invalid using directory from File System Watcher OnChanged Event

    - by Bi
    My C# application throws a System.IO.IOExcepton (The directory name is invalid) for the following code for implementing a filewatcher: public void OnChanged(object source, FileSystemEventArgs e) { DirectoryInfo dList = new DirectoryInfo(e.FullPath); FileInfo[] TxtFiles = dList.GetFiles("*.TXT"); } e.FullPath is "C:/Documents and Settings/Bi/Application Data/TestApp/Reports\\0MA01P62240_000005798_TRI_4947712701738551.TXT". If you notice it seems to append a "\\" to the path when it tracks the file. Any idea what the problem may be?

    Read the article

  • Is the WCF REST Starter Kit still current?

    - by jonhobbs
    I've been researching the possibility of building a REST service in .net and came across the WCF REST Starter Kit. It looks useful but the latest preview release came out over a year ago and there doesn't seem to be a production release. Does that mean it's not being worked on by MS any more? Has it been superseded by something better?

    Read the article

  • Using scanf() in C++ programs is faster than using cin ?

    - by zeroDivisible
    Hello, I don't know if this is true, but when I was reading FAQ on one of the problem providing sites, I found something, that poke my attention: Check your input/output methods. In C++, using cin and cout is too slow. Use these, and you will guarantee not being able to solve any problem with a decent amount of input or output. Use printf and scanf instead. Can someone please clarify this? Is really using scanf() in C++ programs faster than using cin something ? If yes, that is it a good practice to use it in C++ programs? I thought that it was C specific, though I am just learning C++...

    Read the article

  • Using CSS, how can I make overflow:visible; contents overlap adjacent <td> cells?

    - by Structure
    I have the following CSS style code for my table: td { overflow: hidden; white-space:nowrap; } td:hover { overflow: visible; } However, when I hover over a <td> element whos contents (text) are hidden, the result is that the contents become visible but are behind the content of the adjacent cell (right side). I do not think that z-index can be applied to table cell elements, so is there a CSS attribute that I can specify within my td:hover style which will make the content of my <td> tag overlap the content in adjacent cells?

    Read the article

  • Oracle: how to use updateXML to update multiple nodes in a document?

    - by Alessandro Vernet
    I can write: update my_table set xml = updateXML(xml, '/a/b', '1') where document_id = 123 Now what if in the same update query I also want to set /a/c to 2 (in addition /a/b to 1)? I am tempted to write: update my_table set xml = updateXML(xml, '/a/b', '1'), xml = updateXML(xml, '/a/c', '2') where document_id = 123 But this give me a "ORA-00957: duplicate column name". Any suggestion on how to do this?

    Read the article

  • .NET and Closing MSSQL connections

    - by user307076
    I am having a hard time figuring out why the following constructor will not close connnections. When I view the active connections. Here is the code that I have. Public Sub New(ByVal UserID As Integer) Dim oConn As New SqlConnection(ConfigurationManager.ConnectionStrings("connStr").ToString()) Dim cmd As New SqlCommand("stored proc", oConn) Dim sdr As SqlDataReader cmd.CommandType = CommandType.StoredProcedure cmd.Parameters.AddWithValue("@userID", UserID) oConn.Open() sdr = cmd.ExecuteReader() Try If Not sdr.HasRows Then sdr.Close() If Not oConn Is Nothing Then If oConn.State <> ConnectionState.Closed Then oConn.Close() End If End If cmd.Dispose() Exit Sub End If 'User has account in WATS, proceed to load account information While sdr.Read _firstname = Convert.ToString(sdr("First Name")) _lastname = Convert.ToString(sdr("Last Name")) End While Catch ex As Exception 'Throw New Exception("User Error: " + ex.Message) Finally sdr.Close() If Not oConn Is Nothing Then If oConn.State <> ConnectionState.Closed Then oConn.Close() End If End If cmd.Dispose() End Try End Sub

    Read the article

  • UNIX Timestamp to MySQL DATETIME

    - by Henk Denneboom
    Hi all, I have a table with statistics and a field named time with Unix Timestamps. There are about 200 rows in the table, but I would like to change the Unix timestamps to MySQL DATETIME. Without losing the current rows. What would be the best way to update the Unix Timestamp to MySQL's DATETIME? The current table: CREATE TABLE `stats` ( `id` int(11) unsigned NOT NULL auto_increment, `time` int(11) NOT NULL, `domain` varchar(40) NOT NULL, `ip` varchar(20) NOT NULL, `user_agent` varchar(255) NOT NULL, `domain_id` int(11) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 So the time (INT) should be a DATETIME field. Thanks in advance!

    Read the article

  • Android - Getting audio to play through earpiece

    - by Donal Rafferty
    I currently have code that reads a recording in from the devices mic using the AudioRecord class and then playing it back out using the AudioTrack class. My problem is that when I play it out it plays vis the speaker phone. I want it to play out via the ear piece on the device. Here is my code: public class LoopProg extends Activity { boolean isRecording; //currently not used AudioManager am; int count = 0; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); am = (AudioManager) getSystemService(Context.AUDIO_SERVICE); am.setMicrophoneMute(true); while(count <= 1000000){ Record record = new Record(); record.run(); count ++; Log.d("COUNT", "Count is : " + count); } } public class Record extends Thread { static final int bufferSize = 200000; final short[] buffer = new short[bufferSize]; short[] readBuffer = new short[bufferSize]; public void run() { isRecording = true; android.os.Process.setThreadPriority (android.os.Process.THREAD_PRIORITY_URGENT_AUDIO); int buffersize = AudioRecord.getMinBufferSize(11025, AudioFormat.CHANNEL_CONFIGURATION_MONO, AudioFormat.ENCODING_PCM_16BIT); AudioRecord arec = new AudioRecord(MediaRecorder.AudioSource.MIC, 11025, AudioFormat.CHANNEL_CONFIGURATION_MONO, AudioFormat.ENCODING_PCM_16BIT, buffersize); AudioTrack atrack = new AudioTrack(AudioManager.STREAM_MUSIC, 11025, AudioFormat.CHANNEL_CONFIGURATION_MONO, AudioFormat.ENCODING_PCM_16BIT, buffersize, AudioTrack.MODE_STREAM); am.setRouting(AudioManager.MODE_NORMAL,1, AudioManager.STREAM_MUSIC); int ok = am.getRouting(AudioManager.ROUTE_EARPIECE); Log.d("ROUTING", "getRouting = " + ok); setVolumeControlStream(AudioManager.STREAM_VOICE_CALL); //am.setSpeakerphoneOn(true); Log.d("SPEAKERPHONE", "Is speakerphone on? : " + am.isSpeakerphoneOn()); am.setSpeakerphoneOn(false); Log.d("SPEAKERPHONE", "Is speakerphone on? : " + am.isSpeakerphoneOn()); atrack.setPlaybackRate(11025); byte[] buffer = new byte[buffersize]; arec.startRecording(); atrack.play(); while(isRecording) { arec.read(buffer, 0, buffersize); atrack.write(buffer, 0, buffer.length); } arec.stop(); atrack.stop(); isRecording = false; } } } As you can see if the code I have tried using the AudioManager class and its methods including the deprecated setRouting method and nothing works, the setSpeatPoneOn method seems to have no effect at all, neither does the routing method. Has anyone got any ideas on how to get it to play via the earpiece instead of the spaker phone?

    Read the article

  • Box Selection and Multi-Line Editing with VS 2010

    This is the twenty-second in a series of blog posts Im doing on the VS 2010 and .NET 4 release. Ive already covered some of the code editor improvements in the VS 2010 release.  In particular, Ive blogged about the Code Intellisense Improvements, new Code Searching and Navigating Features, HTML, ASP.NET and JavaScript Snippet Support, and improved JavaScript Intellisense.  Todays blog post covers a small, but nice, editor improvement with VS 2010 the ability to use Box Selection...Did you know that DotNetSlackers also publishes .net articles written by top known .net Authors? We already have over 80 articles in several categories including Silverlight. Take a look: here.

    Read the article

  • Microsoft Security Report Points Fingers at ISVs

    Windows security holes have declined in the last year by 8.4 percent, according to a new Microsoft report....Did you know that DotNetSlackers also publishes .net articles written by top known .net Authors? We already have over 80 articles in several categories including Silverlight. Take a look: here.

    Read the article

  • Silverlight 4 SDK Release Candidate Is Available

    Microsoft has unveiled the Release Candidate of the Silverlight 4 SDK. This latest version delivers hundreds of features and controls that present the leading edge in rapid, powerful application development. Note: this is a developer release only that does not have "go-live" licensing available or an end-user runtime....Did you know that DotNetSlackers also publishes .net articles written by top known .net Authors? We already have over 80 articles in several categories including Silverlight. Take a look: here.

    Read the article

  • White Paper: How the Security Development Lifecycle Helped Improve the Security of the 2007 Microsof

    The 2007 Office system was the first Microsoft Office release to include the standardized Security Development Lifecycle (SDL) process throughout the product development life cycle. Read this paper to understand how the SDL contributed to improving the security of the 2007 Microsoft Office System....Did you know that DotNetSlackers also publishes .net articles written by top known .net Authors? We already have over 80 articles in several categories including Silverlight. Take a look: here.

    Read the article

< Previous Page | 7 8 9 10 11 12 13 14 15 16 17 18  | Next Page >