Search Results

Search found 103781 results on 4152 pages for 'am'.

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

  • Need help in retrive date format with am/pm in codeignitor

    - by JigneshMistry
    I have got one problem. which is as follow I have converted date to my local time as below $this->date_string = "%Y/%m/%d %h:%i:%s"; $timestamp = now(); $timezone = 'UP45'; $daylight_saving = TRUE; $time = gmt_to_local($timestamp, $timezone, $daylight_saving); $this->updated_date = mdate($this->date_string,$time); And Storing this field in to database. now at retrive time i want like this format "11-04-2011 4:50:00 PM" I have used this code $timestamp = strtotime($rs->updated_date); $date1 = "%d-%m-%Y %h:%i:%s %a"; $updat1 = date($date1,$timestamp); but this will give me only "11-04-2011 4:50:00 AM" but I have stored in like it was PM. Can any one help me out. thanks.

    Read the article

  • Csharp: I am trying to get the top nth values from and rectangular array

    - by user355925
    I am reading a txt file for strings that represent intergers. the file is space delimited. I have created an array[10,2]. evertime the the strings 1~10 is found in the file I increment array[n,0] by 1. I also feed array[n,1] with numbers 1~10. ie txt file contents: 1/1/1 10/1/2001 1 1 10 2 2 3 1 5 10 word word 3 3 etc.. streamreader reads 1/1/1 and determines that is is not 1~10 streamreader reads 10/1/2001 and determines that it is not 1~10 streamreader reads 1 and ++array[0,0] streamreader reads 1 and ++array[0,0] streamreader reads 10 and ++array[9,0] etc.. the result will be: '1' was found 3 times '2' was found 2 times '3' was found 3 times '5' was found 1 time '10' was found 2 times My problem is that I need this array placed in order(sorted) by value of column 0 so that it would be: 1 3 2 10 5

    Read the article

  • Why am I getting a TypeError when looping?

    - by Lee Crabtree
    I'm working on a Python extension module, and one of my little test scripts is doing something strange, viz.: x_max, y_max, z_max = m.size for x in xrange(x_max): for y in xrange(y_max): for z in xrange(z_max): #do my stuff What makes no sense is that the loop gets to the end of the first 'z' iteration, then throws a TypeError, stating that "an integer is required". If I put a try...except TypeError around it and check the types of x, y, and z, they all come back as < type 'int' . Am I missing something here?

    Read the article

  • Am I underestimating MySQL ?

    - by user281434
    Hi I'm about to implement a feature on my website that recommends content to users based on the content they already have in their library (a la Last.fm). A single table holds all the records of the content they have added, so a row might look something like: -------------------- | userid | content | -------------------- | 28 | a | -------------------- When I want to recommend some content for a user, I use a query to get all the user id's that have content a added in their library. Then, out of those user id's, I make another query that finds the next most common content among those users (fx. 'b'), and show that to the user. My problem is when I'm thinking about the big picture here. Say that eventually my site will hold something like 500.000 rows in the table, will this make the MySQL response very slow or am I underestimating MySQL here?

    Read the article

  • I am requesting ideas on manipulating output from an array and parse to something useful

    - by Cyber Demon
    First I am new to PS scripting. Please be gentle. This simple script I have written is ok. $Iplist = Get-Content ips.txt foreach ($ip in $Iplist) { .\psping -h -n 3 -w 0 $ip >> results.csv } Move-Item "C:\ping\results.csv" ("C:\ping\aftermath\{0:yyyyMMddhhmm}.csv" -f (get-date)) The Output is as follows, as an example (I used www.google.com): Pinging 74.125.225.48 with 32 bytes of data: 3 iterations (warmup 0) ping test: Reply from 74.125.225.48: 54.14ms Reply from 74.125.225.48: 54.85ms Reply from 74.125.225.48: 54.48ms Ping statistics for 74.125.225.48: Sent = 3, Received = 3, Lost = 0 (0% loss), Minimum = 54.14ms, Maximum = 54.85ms, Average = 54.49ms Latency Count 54.14 1 54.17 0 54.21 0 54.25 0 54.29 0 54.32 0 54.36 0 54.4 0 54.44 0 54.47 1 54.51 0 54.55 0 54.59 0 54.62 0 54.66 0 54.7 0 54.74 0 54.77 0 54.81 0 54.85 1 What I'm looking for is something to show me the following as an output. ServerIP Name TimeStamp Results AverageResponseTime in milli-seconds www.google.com 2014-08-14T16:09:59 Up 53 Can you guide me?

    Read the article

  • Scaling a CBitmap - what am I doing wrong?

    - by Smashery
    I've written the following code, which attempts to take a 32x32 bitmap (loaded through MFC's Resource system) and turn it into a 16x16 bitmap, so they can be used as the big and small CImageLists for a CListCtrl. However, when I open the CListCtrl, all the icons are black (in both small and large view). Before I started playing with resizing, everything worked perfectly in Large View. What am I doing wrong? // Create the CImageLists if (!m_imageListL.Create(32,32,ILC_COLOR24, 1, 1)) { throw std::exception("Failed to create CImageList"); } if (!m_imageListS.Create(16,16,ILC_COLOR24, 1, 1)) { throw std::exception("Failed to create CImageList"); } // Fill the CImageLists with items loaded from ResourceIDs int i = 0; for (std::vector<UINT>::iterator it = vec.begin(); it != vec.end(); it++, i++) { CBitmap* bmpBig = new CBitmap(); bmpBig->LoadBitmap(*it); CDC bigDC; bigDC.CreateCompatibleDC(m_itemList.GetDC()); bigDC.SelectObject(bmpBig); CBitmap* bmpSmall = new CBitmap(); bmpSmall->CreateBitmap(16, 16, 1, 24, 0); CDC smallDC; smallDC.CreateCompatibleDC(&bigDC); smallDC.SelectObject(bmpSmall); smallDC.StretchBlt(0, 0, 32, 32, &bigDC, 0, 0, 16, 16, SRCCOPY); m_imageListL.Add(bmpBig, RGB(0,0,0)); m_imageListS.Add(bmpSmall, RGB(0,0,0)); } m_itemList.SetImageList(&m_imageListS, LVSIL_SMALL); m_itemList.SetImageList(&m_imageListL, LVSIL_NORMAL);

    Read the article

  • I am getting this error on using matplotlib

    - by Arun Abraham
    I get this error on typing this in python command prompt: import matplotlib.pyplot as plt Traceback (most recent call last): File "<pyshell#1>", line 1, in <module> import matplotlib.pyplot as plt File "/Library/Python/2.7/site-packages/matplotlib-1.3.x-py2.7-macosx-10.8-intel.egg/matplotlib/pyplot.py", line 97, in <module> _backend_mod, new_figure_manager, draw_if_interactive, _show = pylab_setup() File "/Library/Python/2.7/site-packages/matplotlib-1.3.x-py2.7-macosx-10.8-intel.egg/matplotlib/backends/__init__.py", line 25, in pylab_setup globals(),locals(),[backend_name]) File "/Library/Python/2.7/site-packages/matplotlib-1.3.x-py2.7-macosx-10.8-intel.egg/matplotlib/backends/backend_macosx.py", line 21, in <module> from matplotlib.backends import _macosx ImportError: dlopen(/Library/Python/2.7/site-packages/matplotlib-1.3.x-py2.7-macosx-10.8-intel.egg/matplotlib/backends/_macosx.so, 2): Library not loaded: /System/Library/Frameworks/CoreText.framework/Versions/A/CoreText Referenced from: /Library/Python/2.7/site-packages/matplotlib-1.3.x-py2.7-macosx-10.8-intel.egg/matplotlib/backends/_macosx.so Reason: image not found Can someone suggest me, how i can fix this ? I had installed all the packages with this shell script https://github.com/fonnesbeck/ScipySuperpack Is there anything that i am missing ? Any additional configuration ?

    Read the article

  • I am getting null pointer exception while publishing dynamic web project on jboss using eclipse

    - by Rozer
    I am getting null pointer exception while publishing dynamic web project on jboss using eclipse Environment details Version: 3.3.2 Build id: M20080221-1800 Jboss: 3.2.3 JDK 1.5 I have checked with google, but nothing work, can anyone suggest me what is the root cause for that Following is the log trace may be help to understance the situation !ENTRY org.eclipse.wst.server.core 4 0 2010-06-13 19:03:44.568 !MESSAGE Error calling delegate restart() JBOSS 4.0 !ENTRY org.eclipse.wst.server.core 4 0 2010-06-13 19:39:34.365 !MESSAGE Could not publish to the server. !STACK 0 java.lang.NullPointerException at org.eclipse.wst.common.componentcore.internal.util.ComponentUtilities.getDeployUriOfComponent(ComponentUtilities.java:327) at org.eclipse.jst.j2ee.internal.deployables.J2EEFlexProjDeployable.getURI(J2EEFlexProjDeployable.java:429) at org.eclipse.jst.server.generic.core.internal.publishers.AntPublisher.guessModuleName(AntPublisher.java:259) at org.eclipse.jst.server.generic.core.internal.publishers.AntPublisher.getPublishProperties(AntPublisher.java:224) at org.eclipse.jst.server.generic.core.internal.publishers.AntPublisher.publish(AntPublisher.java:110) at org.eclipse.jst.server.generic.core.internal.GenericServerBehaviour.publishModule(GenericServerBehaviour.java:84) at org.eclipse.wst.server.core.model.ServerBehaviourDelegate.publishModule(ServerBehaviourDelegate.java:749) at org.eclipse.wst.server.core.model.ServerBehaviourDelegate.publishModules(ServerBehaviourDelegate.java:835) at org.eclipse.wst.server.core.model.ServerBehaviourDelegate.publish(ServerBehaviourDelegate.java:669) at org.eclipse.wst.server.core.internal.Server.doPublish(Server.java:887) at org.eclipse.wst.server.core.internal.Server.publish(Server.java:874) at org.eclipse.wst.server.core.internal.PublishServerJob.run(PublishServerJob.java:72) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)

    Read the article

  • IIS 7.5 What am I doing wrong?

    - by chugh97
    In IIS 7.5 under Windows 7 Utilmate, I have an application which is configured for authentication as follows: Anonymous & Windows In the ASP.NET Website, I have turned Forms authentication and identity impersonate = true I also deny any anonymous users. <authentication mode="Forms"> </authentication> <identity impersonate="true"/> <authorization> <deny user="?"> </authorization> IIS complains. What am I doing wrong... What I want to achieve :I want the windows Logged On User so I can build a FormsAuthentication ticket and pass it to a Passive STS. So in IIS I have anonymous and windows...If have only windows ticked, I cannot go onto the Login.aspx page as I have an extra parameter to be passed from there. So now in webconfig, I then disable anonymous users by saying deny user="?" , so it leaves me with the authenticated windows user but using Forms Authentication.You know what I mean??

    Read the article

  • I am getting a Radix out of range exception on performing decryption

    - by user3672391
    I am generating a keypair and converting one of the same into string which later is inserted into the database using the following code: KeyPairGenerator keyGen = KeyPairGenerator.getInstance("RSA"); keyGen.initialize(2048); KeyPair generatedKeyPair = keyGen.genKeyPair(); PublicKey pubkey = generatedKeyPair.getPublic(); PrivateKey prvkey = generatedKeyPair.getPrivate(); System.out.println("My Public Key>>>>>>>>>>>"+pubkey); System.out.println("My Private Key>>>>>>>>>>>"+prvkey); String keyAsString = new BigInteger(prvkey.getEncoded()).toString(64); I then retrieve the string from the database and convert it back to the original key using the following code (where rst is my ResultSet): String keyAsString = rst.getString("privateKey").toString(); byte[] bytes = new BigInteger(keyAsString, 64).toByteArray(); //byte k[] = "HignDlPs".getBytes(); PKCS8EncodedKeySpec encodedKeySpec = new PKCS8EncodedKeySpec(bytes); KeyFactory rsaKeyFac = KeyFactory.getInstance("RSA"); PrivateKey privKey = rsaKeyFac.generatePrivate(encodedKeySpec); On using the privKey for RSA decryption, I get the following exception java.lang.NumberFormatException: Radix out of range at java.math.BigInteger.<init>(BigInteger.java:294) at com.util.SimpleFTPClient.downloadFile(SimpleFTPClient.java:176) at com.Action.FileDownload.processRequest(FileDownload.java:64) at com.Action.FileDownload.doGet(FileDownload.java:94) Please guide.

    Read the article

  • Why am I getting 'Heap Corruption'?

    - by fneep
    Please don't crucify me for this one. I decided it might be good to use a char* because the string I intended to build was of a known size. I am also aware that if timeinfo-tm_hour returns something other than 2 digits, things are going to go badly wrong. That said, when this function returns VIsual Studio goes ape at me about HEAP CORRUPTION. What's going wrong? (Also, should I just use a stringbuilder?) void cLogger::_writelogmessage(std::string Message) { time_t rawtime; struct tm* timeinfo = 0; time(&rawtime); timeinfo = localtime(&rawtime); char* MessageBuffer = new char[Message.length()+11]; char* msgptr = MessageBuffer; _itoa(timeinfo->tm_hour, msgptr, 10); msgptr+=2; strcpy(msgptr, "::"); msgptr+=2; _itoa(timeinfo->tm_min, msgptr, 10); msgptr+=2; strcpy(msgptr, "::"); msgptr+=2; _itoa(timeinfo->tm_sec, msgptr, 10); msgptr+=2; strcpy(msgptr, " "); msgptr+=1; strcpy(msgptr, Message.c_str()); _file << MessageBuffer; delete[] MessageBuffer; }

    Read the article

  • Tinyurl API Example - Am i doing it right :D

    - by Paul Weber
    Hi ... we use super-long Hashes for the Registration of new Users in our Application. The Problem is that these Hashes break in some Email Clients - making the Links unusable. I tried implementing the Tinyurl - API, with a simple Call, but i think it times out sometimes ... sometimes the mail does not reach the user. I updated the Code, but now the URL is never converted. Is Tinyurl really so slow or am i doing something wrong? (I mean hey, 5 Seconds is much in this Times) Can anybody recommend me a more reliable service? All my Fault, forgot a false in the fopen. But i will leave this sample of code here, because i often see this sample, wich i think does not work very reliable: return file_get_contents('http://tinyurl.com/api-create.php?url='.$u); This is the - i think fully working sample. I would like to hear about Improvements. static function gettinyurl( $url ) { $context = stream_context_create( array( 'http' => array( 'timeout' => 5 // 5 Seconds should be enough ) ) ); // get tiny url via api-create.php $fp = fopen( 'http://tinyurl.com/api-create.php?url='.$url, 'r', $context); // open (read) api-create.php with long url as get parameter if( $fp ) { // check if open was ok $tinyurl = fgets( $fp ); // read response if( $tinyurl && !empty($tinyurl) ) // check if response is ok $url = $tinyurl; // set response as url fclose( $fp ); // close connection } // return return $url; // return (tiny) url }

    Read the article

  • Jquery autocomplete webservices - what am i doing wrong??

    - by dzajdol
    I created a class for JSON responses: public class PostCodeJson { public String Text { get; private set; } public String Value { get; private set; } #region Constructors /// <summary> /// Empty constructor /// </summary> public PostCodeJson() { this.Text = String.Empty; this.Value = String.Empty; } /// <summary> /// Constructor /// </summary> /// <param name="_text"></param> /// <param name="_value"></param> public PostCodeJson(String _text, String _value) { this.Text = _text; this.Value = _value; } #endregion Constructors } and function returns list of this class using in webservices method: [WebMethod] public List<PostCodeJson> GetPostCodesCompletionListJson(String prefixText, Int32 count) { return LibDataAccess.DBServices.PostCodes.GetPostCodeJson(prefixText, count); } And in aspx i do this that: <script> $(document).ready(function() { $("#<%=pc.ClientID %>").autocomplete( baseUrl + "WebServices/Autocomplete.asmx/GetPostCodesCompletionListJson", { parse: function(data) { var array = new Array(); for (var i = 0; i < data.length; i++) { var datum = data[i]; var name = datum.Text; var display = name; array[array.length] = { data: datum, value: display, result: datum.Value }; } return array; }, dataType: "xml" }); }); </script> and when you enter something in the box i got an error: Request format is unrecognized for URL unexpectedly ending in '/GetPostCodesCompletionListJson What am I doing wrong??

    Read the article

  • Am I abusing Policies?

    - by pmr
    I find myself using policies a lot in my code and usually I'm very happy with that. But from time to time I find myself confronted with using that pattern in situations where the Policies are selected and runtime and I have developed habbits to work around such situations. Usually I start with something like that: class DrawArrays { protected: void sendDraw() const; }; class DrawElements { protected: void sendDraw() const; }; template<class Policy> class Vertices : public Policy { using Policy::sendDraw(); public: void render() const; }; When the policy is picked at runtime I have different choices of working around the situation. Different code paths: if(drawElements) { Vertices<DrawElements> vertices; } else { Vertices<DrawArrays> vertices; } Inheritance and virtual calls: class PureVertices { public: void render()=0; }; template<class Policy> class Vertices : public PureVertices, public Policy { //.. }; Both solutions feel wrong to me. The first creates an umaintainable mess and the second introduces the overhead of virtual calls that I tried to avoid by using policies in the first place. Am I missing the proper solutions or do I use the wrong pattern to solve the problem?

    Read the article

  • I am confused -- Will this code always work?

    - by Shekhar
    Hello, I have written this piece of code public class Test{ public static void main(String[] args) { List<Integer> list = new ArrayList<Integer>(); for(int i = 1;i<= 4;i++){ new Thread(new TestTask(i, list)).start(); } while(list.size() != 4){ // this while loop required so that all threads complete their work } System.out.println("List "+list); } } class TestTask implements Runnable{ private int sequence; private List<Integer> list; public TestTask(int sequence, List<Integer> list) { this.sequence = sequence; this.list = list; } @Override public void run() { list.add(sequence); } } This code works and prints all the four elements of list on my machine. My question is that will this code always work. I think there might be a issue in this code when two/or more threads add element to this list at the same point. In that case it while loop will never end and code will fail. Can anybody suggest a better way to do this? I am not very good at multithreading and don't know which concurrent collection i can use? Thanks Shekhar

    Read the article

  • Am I using Settings in .NET correctly?

    - by Sergio Tapia
    Here's what I'm doing. I have three properties: MomsBackground, DadsBackground and ChosenBackground. When Momsbackground is selected in the program, I set the ChosenBackground string according to what item the user has clicked (either "Mom" or "Dad"). Then on Form_Load() I use a switch case for the ChosenBackground string and according to that select This.BackgroundColor to MomsBackground or DadsBackground. Code below: Am I using this as it was intended? Sorry, codes there now. using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace WindowsFormsApplication1 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void momToolStripMenuItem_Click(object sender, EventArgs e) { this.BackColor = Properties.Settings.Default.MomFormColor; Properties.Settings.Default.SelectedTheme = "Mom"; Properties.Settings.Default.Save(); } private void dadToolStripMenuItem_Click(object sender, EventArgs e) { this.BackColor = Properties.Settings.Default.DadFormColor; Properties.Settings.Default.SelectedTheme = "Dad"; Properties.Settings.Default.Save(); } private void Form1_Load(object sender, EventArgs e) { switch (Properties.Settings.Default.SelectedTheme) { case "Mom": this.BackColor = Properties.Settings.Default.MomFormColor; break; case "Dad": this.BackColor = Properties.Settings.Default.DadFormColor; break; default: break; } } } }

    Read the article

  • Am I using handlers in the wrong way?

    - by superexsl
    Hey, I've never used HTTP Handlers before, and I've got one working, but I'm not sure if I'm actually using it properly. I have generated a string which will be saved as a CSV file. When the user clicks a button, I want the download dialog box to open so that the user can save the file. What I have works, but I keep reading about modifying the web.config file and I haven't had to do that. My Handler: private string _data; private string _title = "temp"; public void AddData(string data) { _data = data; } public bool IsReusable { get { return false; } } public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/csv"; context.Response.AddHeader("content-disposition", "filename=" + _title + ".csv"); context.Response.Write(_data); context.Response.Flush(); context.Response.Close(); } And this is from the page that allows the user to download: (on button click) string dataToConvert = "MYCSVDATA...."; csvHandler handler = new csvHandler(); handler.AddData(dataToConvert); handler.ProcessRequest(this.Context); This works fine, but no examples I've seen ever instantiate the handler and always seem to modify the web.config. Am I doing something wrong? Thanks

    Read the article

  • I am totally unable to add a fileTree (JQuery fileTree addon) to my asp.net page

    - by Gadgetsan
    okay, so i have an asp.net (C#) application and i want to add a list of file and folders on the page, so i figured i should use JQuery fileTree (http://abeautifulsite.net/2008/03/jquery-file-tree/#download) but now i am totally unable to display the file list. I initialise the page this way: Site.Master: <link rel="stylesheet" type="text/css" href="../../Content/superfish.css" media="screen"> <link href="../../Content/jqueryFileTree.css" rel="stylesheet" type="text/css" /> <script src="../../Scripts/jquery-1.4.1.min.js" type="text/javascript"></script> <script src="../../Scripts/jquery.easing.1.3.js" type="text/javascript"></script> <script src="../../Scripts/jqueryFileTree.js" type="text/javascript"></script> <script src="../../Scripts/JqueryUI/js/jquery-ui-1.8.1.custom.min.js" type="text/javascript"></script> <script type="text/javascript" src="../../Scripts/jquery.dataTables.js"></script> <script type="text/javascript" src="../../Scripts/superfish.js"></script> <script type="text/javascript"> $(document).ready(function() { test = $('#fileTree').fileTree({script: "jqueryFileTree.aspx" }, function(file) { openFile(file); }); $("button").button(); oTable = $('#data').dataTable({ "bJQueryUI": true, "sPaginationType": "full_numbers", "bSort": true }); }); </script> and in the page, i put my div this way: <asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server"> Documents but i'm positive that jqueryFileTree.aspx is never "called" because if i return this page in my controller, it shows the list of files/folder correctly, so it's also not a problem with my aspx connector... Also i checked, on the JS console, it gives no error and there is nothing more in the page source code i've been trying to solve this all day without success so your help is apreciated

    Read the article

  • Drupal Studs help me with my form_alter hook ( I am almost there)

    - by user363036
    So I think I am almost there conceptually but need some missing pointers. Objective is to add a few more fields to the normal user registration form, style it a little, then submit it with storing the extra fields in a table. This is what I have so far. Can someone give me the final nudge and get me going. Please help me. Also how do I apply some minor styling like aligning the new form fields ? Thank you so much !!!!!!!!! function module_menu() { $items = array(); $items['school/registration'] = array( 'title' = 'Upgraded Registration Form', 'page callback' ='module_school_register', 'type' = MENU_CALLBACK ); return $items; }//end of the function function module_school_register(){ return drupal_get_form('form_school_register'); }//end of the function function module_school_form_alter(&$form, $form_state, $form_id) { dsm($form_id); if ($form_id == 'user_registration_form') { // modify the "#submit" form property by prepending another submit handler array $form['#submit'] = array_merge( array('_module_registration_submit' = array()), $form['#submit'] ); } } function _module_registration_submit($form_id, $form_values) { // store extra data in different table } function module_registration_validate($form, &$form_state) { $error=0; //Validation stuff here, set $error to true if something went wrong, or however u want to do this. Completely up to u in how u set errors. if ($error) { form_set_error('new_field_name', 'AHH SOMETHING WRONG!'); } }

    Read the article

  • I am not able to kill a child process using TerminateProcess

    - by user1681210
    I have a problem to kill a child process using TerminateProcess. I call to this function and the process still there (in the Task Manager) This piece of code is called many times launching the same program.exe many times and these process are there in the task manager which i think is not good. sorry, I am quiet new in c++ I will really appreciate any help. thanks a lot!! the code is the following: STARTUPINFO childProcStartupInfo; memset( &childProcStartupInfo, 0, sizeof(childProcStartupInfo)); childProcStartupInfo.cb = sizeof(childProcStartupInfo); childProcStartupInfo.hStdInput = hFromParent; // stdin childProcStartupInfo.hStdOutput = hToParent; // stdout childProcStartupInfo.hStdError = hToParentDup; // stderr childProcStartupInfo.dwFlags = STARTF_USESTDHANDLES | STARTF_USESHOWWINDOW; childProcStartupInfo.wShowWindow = SW_HIDE; PROCESS_INFORMATION childProcInfo; /* for CreateProcess call */ bOk = CreateProcess( NULL, // filename pCmdLine, // full command line for child NULL, // process security descriptor */ NULL, // thread security descriptor */ TRUE, // inherit handles? Also use if STARTF_USESTDHANDLES */ 0, // creation flags */ NULL, // inherited environment address */ NULL, // startup dir; NULL = start in current */ &childProcStartupInfo, // pointer to startup info (input) */ &childProcInfo); // pointer to process info (output) */ CloseHandle( hFromParent ); CloseHandle( hToParent ); CloseHandle( hToParentDup ); CloseHandle( childProcInfo.hThread); CloseHandle( childProcInfo.hProcess); TerminateProcess( childProcInfo.hProcess ,0); //this is not working, the process thanks

    Read the article

  • Am I encrypting my passwords correctly in ASP.NET

    - by Nick
    I have a security class: public class security { private static string createSalt(int size) { //Generate a random cryptographic number RNGCryptoServiceProvider rng = new RNGCryptoServiceProvider(); byte[] b = new byte[size]; rng.GetBytes(b); //Convert to Base64 return Convert.ToBase64String(b); } /// <summary> /// Generate a hashed password for comparison or create a new one /// </summary> /// <param name="pwd">Users password</param> /// <returns></returns> public static string createPasswordHash(string pwd) { string salt = "(removed)"; string saltAndPwd = string.Concat(pwd, salt); string hashedPwd = FormsAuthentication.HashPasswordForStoringInConfigFile( saltAndPwd, "sha1"); return hashedPwd; } } This works fine, but I am wondering if it is sufficient enough. Also, is this next block of code better? Overkill? static byte[] encrInitVector = new byte[] { 0x12, 0x34, 0x56, 0x78, 0x90, 0xAB, 0xCD, 0xEF }; static string encrKey = "(removed)"; public static string EncryptString(string s) { byte[] key; try { key = Encoding.UTF8.GetBytes(encrKey.Substring(0, 8)); DESCryptoServiceProvider des = new DESCryptoServiceProvider(); byte[] inputByteArray = Encoding.UTF8.GetBytes(s); MemoryStream ms = new MemoryStream(); CryptoStream cs = new CryptoStream(ms, des.CreateEncryptor(key, encrInitVector), CryptoStreamMode.Write); cs.Write(inputByteArray, 0, inputByteArray.Length); cs.FlushFinalBlock(); return Convert.ToBase64String(ms.ToArray()); } catch (Exception e) { throw e; }

    Read the article

  • Am I doing AS3 reference cleanup correctly?

    - by Ólafur Waage
    In one frame of my fla file (let's call it frame 2), I load a few xml files, then send that data into a class that is initialized in that frame, this class creates a few timers and listeners. Then when this class is done doing it's work. I call a dispatchEvent and move to frame 3. This frame does some things as well, it's initialized and creates a few event listeners and timers. When it's done, I move to frame 2 again. This is supposed to repeat as often as I need so I need to clean up the references correctly and I'm wondering if I'm doing it correctly. For sprites I do this. world.removeChild(Background); // world is the parent stage Background = null; For instances of other classes I do this. Players[i].cleanUp(world); // do any cleanup within the instanced class world.removeChild(PlayersSelect[i]); For event listeners I do this. if(Background != null) { Background.removeEventListener(MouseEvent.CLICK, deSelectPlayer); } For timers I do this. if(Timeout != null) { Timeout.stop(); Timeout.removeEventListener(TimerEvent.TIMER, queueHandler); Timeout.removeEventListener(TimerEvent.TIMER_COMPLETE, queueCompleted); Timeout = null; } And for library images I do this if(_libImage!= null) { s.removeChild(Images._libImage); // s is the stage _libImage= null; } And for the class itself in the main timeline, I do this Frame2.removeEventListener("Done", IAmDone); Frame2.cleanUp(); // the cleanup() does all the stuff above Frame2= null; Even if I do all this, when I get to frame 2 for the 2nd time, it runs for 1-2 seconds and then I get a lot of null reference errors because the cleanup function is called prematurely. Am I doing the cleanup correctly? What can cause events to fire prematurely?

    Read the article

  • Am I a dinosaur programmer?

    - by dlb
    I have been a professional programmer for more than 30 years, and have chosen a career path involving hands-on programming. Programming is something that I love, and I take great pride in the fact that I have continued to keep up to date with current technology. Projects on which I have worked include large enterprise projects as well as smaller desktop programs. The problem I am facing is that I do not have any web-based experience other than some web services. Most of the jobs now available have some web component. I have now been out of work for a year and a half, and have been keeping busy by studying technology that will bridge that gap: CSS, Java Script, JQuery, and Ruby on Rails; AJAX is next. Hiring managers give no consideration whatsoever to the studying that I have been doing. I know that I cannot compete at a senior software level, but companies will not hire someone with my experience at a more junior level. Is there any way to break out of this Catch 22?

    Read the article

  • I am using a regex snippet query string path

    - by Shelby Poston
    Using the following to load images base on two ids one is the and bookid and the out is the client. My folder structures is this. root path = flipbooks subfolders under flipbooks are books and clients in subfolder books I have and .net page title tablet. the tablet code behind checks the bookid of client and render a the tablet page with images in a flipbook fashion. because we have over 15000 records and flipbooks already created and stored in the database. I don't move the client folder under the books subfolders. I need the code below to get to the client subfolder in the query string and help to change this would be helpful. The result now is http://www.somewebsite.com/books/client/images/someimage1.jpg[^] I need the results to be http://www.somewebsite.com/client/images/someimage1.jpg[^]. I tried moving the tablet.aspx file to the root flipbooks and it works but i have provide a user name and password each time. This need to be access by the public and my root is protected. Don't want to have to change permission. I am trying to remove the /books function getParameterByName(name) { var results = RegExp('[?&]' + name + '=([^&]*)').exec(window.location.search); return results ? decodeURIComponent(results[1].replace(/\+/g, ' ')) : null; } Thanks Mission Critical

    Read the article

  • ArrayAdapter need to be clear even i am creating a new one

    - by Roi
    Hello I'm having problems understanding how the ArrayAdapter works. My code is working but I dont know how.(http://amy-mac.com/images/2013/code_meme.jpg) I have my activity, inside it i have 2 private classes.: public class MainActivity extends Activity { ... private void SomePrivateMethod(){ autoCompleteTextView.setAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_spinner_dropdown_item, new ArrayList<String>(Arrays.asList("")))); autoCompleteTextView.addTextChangedListener(new MyTextWatcher()); } ... private class MyTextWatcher implements TextWatcher { ... } private class SearchAddressTask extends AsyncTask<String, Void, String[]> { ... } } Now inside my textwatcher class i call the search address task: @Override public void afterTextChanged(Editable s) { new SearchAddressTask().execute(s.toString()); } So far so good. In my SearchAddressTask I do some stuff on doInBackground() that returns the right array. On the onPostExecute() method i try to just modify the AutoCompleteTextView adapter to add the values from the array obtained in doInBackground() but the adapter cannot be modified: NOT WORKING CODE: protected void onPostExecute(String[] addressArray) { ArrayAdapter<String> adapter = (ArrayAdapter<String>) autoCompleteDestination.getAdapter(); adapter.clear(); adapter.addAll(new ArrayList<String>(Arrays.asList(addressArray))); adapter.notifyDataSetChanged(); Log.d("SearchAddressTask", "adapter isEmpty : " + adapter.isEmpty()); // Returns true!!??! } I dont get why this is not working. Even if i run it on UI Thread... I kept investigating, if i recreate the arrayAdapter, is working in the UI (Showing the suggestions), but i still need to clear the old adapter: WORKING CODE: protected void onPostExecute(String[] addressArray) { ArrayAdapter<String> adapter = (ArrayAdapter<String>) autoCompleteDestination.getAdapter(); adapter.clear(); autoCompleteDestination.setAdapter(new ArrayAdapter<String>(NewDestinationActivity.this,android.R.layout.simple_spinner_dropdown_item, new ArrayList<String>(Arrays.asList(addressArray)))); //adapter.notifyDataSetChanged(); // no needed Log.d("SearchAddressTask", "adapter isEmpty : " + adapter.isEmpty()); // keeps returning true!!??! } So my question is, what is really happening with this ArrayAdapter? why I cannot modify it in my onPostExecute()? Why is working in the UI if i am recreating the adapter? and why i need to clear the old adapter then? I dont know there are so many questions that I need some help in here!! Thanks!!

    Read the article

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