Search Results

Search found 91526 results on 3662 pages for 'clean code'.

Page 190/3662 | < Previous Page | 186 187 188 189 190 191 192 193 194 195 196 197  | Next Page >

  • Netbeans code templates' modifiers

    - by hsz
    Hello ! I set a new PHP code template in Netbeans: /* @var $$${name}Table Model_${name}_Table */ $$${name}Table = Container::get('model')->get('${name}_Table'); and if I use as ${name} some value - shop - I have in output: /* @var $shopTable Model_shop_Table */ $shopTable = Container::get('model')->get('shop_Table'); Is it possible to add some modifier to the second and fourth ${name} so I will have it started with upper letter ? Shop_Table instead of shop_Table

    Read the article

  • Is a line formed by two points greater than 90 degrees off of the horzontal.

    - by Scott Chamberlain
    I am trying to find out if a line defined by two points is greater than or equal to 90 degrees compared to the horizontal. Here is the code I used bool moreThan90 = false; double angle = Math.Atan((double)(EndingLocation.Y - Location.Y) / (double)(EndingLocation.X - Location.X)); if (angle >= Math.PI / 2.0 || angle <= -Math.PI / 2.0) moreThan90 = true; Did I do this correctly or is there a better built in function in .Net that will find this?

    Read the article

  • PHP Code and Linefeeds/Carriage Returns

    - by tonsils
    Hi, Just wondering, would the following code arrangement cause any issues when calling mysql_connect, i.e.: public function connect() { mysql_connect($this->host, $this->username, $this->password) or die("Could not connect. " . mysql_error()); or does it need to be all on one line, i.e.: mysql_connect($this->host,$this->username,$this->password) or die("Could not connect. " . mysql_error()); Thanks.

    Read the article

  • Calling CryptUIWizDigitalSign from .NET on x64

    - by Joe Kuemerle
    I am trying to digitally sign files using the CryptUIWizDigitalSign function from a .NET 2.0 application compiled to AnyCPU. The call works fine when running on x86 but fails on x64, it also works on an x64 OS when compiled to x86. Any idea on how to better marshall or call from x64? The Win32exception returned is "Error encountered during digital signing of the file ..." with a native error code of -2146762749. The relevant portion of the code are: [StructLayout(LayoutKind.Sequential)] public struct CRYPTUI_WIZ_DIGITAL_SIGN_INFO { public Int32 dwSize; public Int32 dwSubjectChoice; [MarshalAs(UnmanagedType.LPWStr)] public string pwszFileName; public Int32 dwSigningCertChoice; public IntPtr pSigningCertContext; [MarshalAs(UnmanagedType.LPWStr)] public string pwszTimestampURL; public Int32 dwAdditionalCertChoice; public IntPtr pSignExtInfo; } [DllImport("Cryptui.dll", CharSet=CharSet.Unicode, SetLastError=true)] public static extern bool CryptUIWizDigitalSign(int dwFlags, IntPtr hwndParent, string pwszWizardTitle, ref CRYPTUI_WIZ_DIGITAL_SIGN_INFO pDigitalSignInfo, ref IntPtr ppSignContext); CRYPTUI_WIZ_DIGITAL_SIGN_INFO digitalSignInfo = new CRYPTUI_WIZ_DIGITAL_SIGN_INFO(); digitalSignInfo = new CRYPTUI_WIZ_DIGITAL_SIGN_INFO(); digitalSignInfo.dwSize = Marshal.SizeOf(digitalSignInfo); digitalSignInfo.dwSubjectChoice = 1; digitalSignInfo.dwSigningCertChoice = 1; digitalSignInfo.pSigningCertContext = pSigningCertContext; digitalSignInfo.pwszTimestampURL = timestampUrl; digitalSignInfo.dwAdditionalCertChoice = 0; digitalSignInfo.pSignExtInfo = IntPtr.Zero; digitalSignInfo.pwszFileName = filepath; CryptUIWizDigitalSign(1, IntPtr.Zero, null, ref digitalSignInfo, ref pSignContext)); And here is how the SigningCertContext is retrieved (minus various error handling) public IntPtr GetCertContext(String pfxfilename, String pswd) IntPtr hMemStore = IntPtr.Zero; IntPtr hCertCntxt = IntPtr.Zero; IntPtr pProvInfo = IntPtr.Zero; uint provinfosize = 0; try { byte[] pfxdata = PfxUtility.GetFileBytes(pfxfilename); CRYPT_DATA_BLOB ppfx = new CRYPT_DATA_BLOB(); ppfx.cbData = pfxdata.Length; ppfx.pbData = Marshal.AllocHGlobal(pfxdata.Length); Marshal.Copy(pfxdata, 0, ppfx.pbData, pfxdata.Length); hMemStore = Win32.PFXImportCertStore(ref ppfx, pswd, CRYPT_USER_KEYSET); pswd = null; if (hMemStore != IntPtr.Zero) { Marshal.FreeHGlobal(ppfx.pbData); while ((hCertCntxt = Win32.CertEnumCertificatesInStore(hMemStore, hCertCntxt)) != IntPtr.Zero) { if (Win32.CertGetCertificateContextProperty(hCertCntxt, CERT_KEY_PROV_INFO_PROP_ID, IntPtr.Zero, ref provinfosize)) pProvInfo = Marshal.AllocHGlobal((int)provinfosize); else continue; if (Win32.CertGetCertificateContextProperty(hCertCntxt, CERT_KEY_PROV_INFO_PROP_ID, pProvInfo, ref provinfosize)) break; } } finally { if (pProvInfo != IntPtr.Zero) Marshal.FreeHGlobal(pProvInfo); if (hMemStore != IntPtr.Zero) Win32.CertCloseStore(hMemStore, 0); } return hCertCntxt; }

    Read the article

  • i got an error in login code

    - by user298349
    I tried writing a login code in vc#..i got the following error..'The type or namespace name 'LoginControl' does not exist in the namespace 'ErikSchmidt' (are you missing an assembly reference?)' Pls help me rectify this error.

    Read the article

  • adding the style attribute via code

    - by nourdine
    hello I was wondering how to assign a style via code in adroid. suppose I have a TextView created with the following snippet: TextView myText = new TextView(this); how do I assign the class xxx so that myText will be styled like an hard coded TextView like this: <TextView style="@style/xxx" /> thanks

    Read the article

  • which version of the code below is right?

    - by TheVillageIdiot
    Hi I found this function in a utilities code file: Version 1: public static bool IsValidLong(string strLong) { bool result = true; try { long tmp = long.Parse(strLong); } catch (Exception ex) { result = false; } return result; } I want to replace this (and validators for other types) with following: Version 2: public static bool IsValidLong(string strLong) { long l; return long.TryParse(strLong, out l); } which version is better and why?

    Read the article

  • Easily porting Lua code to C#

    - by mnn
    Hello, is there any easy way to port Lua code to C#? The biggest problem would probably be to port tables neatly in some dictionaries. And to prevent any misunderstanding: no I cannot use embedded Lua in my program.

    Read the article

  • What is wrong with this code? [closed]

    - by rajesh
    function checkLength(obj,url){ //alert("URL="+url+" OBJ="+obj); if(obj) { var params = 'query='+obj; var myAjax = new Ajax.Request(url, { method: 'post', parameters: params, onComplete: loadResponse }); } } The code isn't working, but I don't know why. I think I need to include other files, but I don't know which

    Read the article

  • convert portion of code into a function php

    - by user765368
    This is probably very easy to do but for some reason I can't seem to figure this out. Let's say I have code like this: $elements = array('a', 'b', 'c', 'd'); $myValues = array( 'values' => array( 'a' => array( 'xx' => 3, 'yy' => '' ), 'b' => array( 'xx' => '', 'yy' => '' ), 'c' => array( 'xx' => 8.4, 'yy' => '' ), 'd' => array( 'xx' => 18.4, 'yy' => '' ) ) ); foreach($elements as $elem) { if($myValues['values'][$elem]['xx'] != '') { if($myValues['values'][$elem]['xx'] < 6) { $myValues['values'][$elem]['yy'] = 'less than 6'; } elseif($myValues['values'][$elem]['xx'] >= 6 && $myValues['values'][$elem]['xx'] < 15) { $myValues['values'][$elem]['yy'] = 'between 6 and 16'; } else { $myValues['values'][$elem]['yy'] = 'greater than 15'; } testFunc($myValues['values'][$elem]['xx']); // This is how I would call my function once I replace the code above } } As you can see here what I'm trying to do is to change the value of $myValues['values'][$elem]['yy'] based on some conditions. What I want to do is to replace the if elseif else section of codes by a function that performs the same action. I tried something like: function testFunc($xx) { if($xx < 6) { $yy = 'less than 6'; } elseif($xx >= 6 && $xx < 15) { $yy = 'between 6 and 16'; } else { $yy = 'greater than 15'; } return $yy; } But obviously this won't work because I'm not changing the value of $myValues['values'][$elem]['yy'] inside my function. NOTE I really want to pass ONLY the value of $myValues['values'][$elem]['xx'] inside my function and return the changed value of $myValues['values'][$elem]['yy']. Can anybody help me with this? Thanks in advance

    Read the article

  • Where does that randomness come from ?

    - by Jules Olléon
    I'm working on a data mining research project and use code from a big svn. Apparently one of the methods I use from that svn uses randomness somewhere without asking for a seed, which makes 2 calls to my program return different results. That's annoying for what I want to do, so I'm trying to locate that "uncontrolled" randomness. Since the classes I use depend on many other, that's pretty painful to do by hand. Any idea how I could find where that randomness comes from ?

    Read the article

  • [CPAINT Error] invalid HTTP response code ‘0’

    - by Abs
    Hello all, I am trying to make use of a script that uses CPAINT and I keep getting the error above when I click on favourite an item (a 5 star rating system). It looks like it is making an AJAX request but I can not see this from my Firebug to debug this - why is this the case? More importantly what does the error code 0 mean? Thank you all for any help

    Read the article

  • what's wrong with this code?

    - by user329820
    Hi this is my code which will not work correctly ! what is wrong with its data type :( thanks CREATE TABLE T1 (A INTEGER NOT NULL); CREATE TABLE T3 (A SMALLINT NOT NULL); INSERT T1 VALUES (32768.5); SELECT * FROM T1; INSERT T3 SELECT * FROM T1; SELECT * FROM T3;

    Read the article

< Previous Page | 186 187 188 189 190 191 192 193 194 195 196 197  | Next Page >