Posts

Showing posts from June, 2013

ruby on rails - rake: Best way of handling an undefined parameter? -

I found a rake work on a rail app that needs a parameter called USER_ID I think I want to throw an exception that stops the execution. This is how my work looks like: desc "My rake work" function: my_task = & gt; : Envionment user_id = ENV ["USER_ID"] or # thrown something here with # user_id stuff what is happening on the code about something like this: raise "USER_ID Missing! \ N \ ne.g: my_task USER_ID = 6 "If (user_id = ENV ['USER_ID']) is empty?

c# - SQLite injection with list of strings -

Can someone tell me that to prevent SQL injection on SQLite creating questions Where is a method where in the section a "myval IN (string_1, ..., string_n)" condition? Although I'm dynamically creating and adding command text with annotations, is there an easy way to get those annotation parameters from the string list? Thank you. No, there is no easy way. Do not create a list of hazardous characters. Use the command with parameters. (Var command = conn.CreateCommand ()) (using conn.Open ()) using conv = new SQLiteconnection (connectionString) command. Command. Command Text: "Choose names from persons where id = @id"; Command. Parameter. Advant Value ("@ id", 5); {Reader.Read ()} {}}} while using Var reader = command.ExecuteReader ())

python - Create string(s) from list(s) items -

I have a list, list = ['af,' 'bar'] and now I want to make strings from each item. Each string is named as an item and has the value of the item foo = 'foo' bar = 'bar' Thank you for, I do not want to do that. for strings = dict (x, x))

.NET 4.0 - CultureNotFoundException -

I created my ASP.NET MVC 2 project as VS 2010+ .NET 4.0 is migrated. Now when I start the application, I get a lot of "culanotefound exception" in the Intelliress and Output / Gebug window: typing 'system. Globalization. One of the first opportunity exceptions of 'Culture Notepad Exception' happened in mscorlib.dll I know what "first chance exception" means, but when I try to debug (absent / exception [throw Has been added to the "culture notfound exception")) I got this detailed exception text: The system Globalization. Culture Notfound Execution has happened Message = Culture is not supported. Parameter Name: Name Designer is an invalid culture identifier. Source = mscorlib ParamName = name InvalidCultureName = Designer StackTrace: System.Globalization.CultureInfo..ctor (string name, boolean usageUserverride) InnerException: I wonder why .Net is called CultureInfo Trying to make the name "designer" with? Is not this

wix - Determining IIS user for IIS 5 -

I am writing a Wix-based setup for a web application and would like to set permissions on the folders that install it. Can reach them. Use IIS 6 and 7, respectively, using IIS_WPG and IIS_USRS , and uses IIS 5 IUSR_COMPUTER NAME . If the user has changed the name of his machine, however, the permissions of using the current computer name fails. Is there a way to determine the user account in programming is being used by IIS 5, assuming that it would be IUSR_COMPUTERNAME ? I am doing it like this (do not pretend to provide the best practice solution) - this is immediate CA sets the properties that you can use later: [custom action] public static action realt set IUSR account statement ( Session session) {Axcarsult ActionResult = Action Result Failer; DirectoryEntry iisAdmin = New DirectoryInter ("IIS: //LostalHost / W3SVC"); If (iisAdmin! = Null) {string iusrName = (string) iisAdmin.Properties ["anonymous user name"] [0]; If (! String.IsNullOrEmpt

mapping - biztalk map from unbounded with subelement to unbounded -

स्रोत XSD संरचना: दस्तावेज़ (न्यूनतम 1 होता है, अधिकतम 1 होता है) दस्तावेज़ ( दस्तावेज (न्यूनतम 1 होता है, अधिकतम 1 होता है), न्यूनतम 1 होता है, अधिकतम होता है) फ़ाइल नाम (न्यूनतम 1 होता है, अधिकतम 1 होता है) 1 <1 (संपादित करें): पहला प्रदान किया गया समाधान था 1) फ़ाइल नाम (न्यूनतम 1 होता है, अधिकतम होता असफल होता है) यह BizTalk mapper में कैसे किया जा सकता है? मेरा पहला कार्यान्वयन, लेकिन ऐसा लगता है कि BizTalk में टेस्ट मैप विकल्प (BizTalk नक्शा .btm फ़ाइल पर दाएं माउस) को कभी-कभी एक अतिरिक्त संकलन की आवश्यकता होती है (मैं केवल मानचित्र को सहेजा गया और फिर मैंने टेस्ट मैप विकल्प के साथ नक्शे का परीक्षण किया)। अब यह काम करता है। बिज़्टेक 2009 में (और संभवत: 2006 भी) बस "फाइलनाम" नोड्स को कनेक्ट करें। स्रोत स्कीमा: & lt;? Xml संस्करण = "1.0" एन्कोडिंग = "यूटीएफ -16"? & Gt; & Lt; xs: स्कीमा xmlns: b = "http://schemas.microsoft.com/BizTalk/2003" xmlns = "http: // source" targetNamespace = "

mod rewrite - mod_rewrite http://localhost/home/ or http://localhost/home to home.php -

I have a very simple question that I want to redirect all requests and home. Php My .htaccess file includes: Rev. ^ ^ home / $ home.php [L] < / Pre> which only works for How can I work in the URL without / ? Is it possible to do this in a line, as opposed to two separate rows: Rev. ryuule ^ home / $ home.php RivieraTyme ^ Home $ home.php < / Pre> thanks :) rewrite rule ^ home /? $ Home.php [L]

javascript - jQuery toggle(); -

I am loading data in a cluetip () dynamically by AJAX. I want to toggle the result such as a link: $ (document) .ready (function () {$ ("# calendarLink") Live ( "Click", (function () {$ ("# result"). Toggle ();}));}); Will not work over for any reason. Can you give an alternative suggestion? some questions / points do you actually .live ( ) You are using an ID selector, so only one of these should be. In addition, you have an additional set of brackets probably not a problem, but you can remove them: $ (document) .ready (function () {$ ("# CalendarLink"). (Function () {$ ("# result"). Toggle ();});});

http status code 404 - ASP.NET MVC - Elmah not working and returning 404 page for elmah.axd -

I am trying to use the alpha for my MVC application and I have followed the wiki steps :, But also 404 - File or directory could not be found. Can anyone help me? OBS: My IIS version is 7.5 If I am posting the appropriate sections of my web.config: Lt; SectionGroup name = "elmah" & gt; & Lt; Section name = "security" required display = "false" type = "elm security security handler, elma" / & gt; & Lt; Section name = "error log" display = "false" type = "elm. Eralogoghication handler, elma" / & gt; & Lt; Section name = "error mail" required display = "false" type = "elmah error mailshakes handler, elma" /> & Lt; Section name = "error filter" required Promotion = "false" type = "elm. Aaffilteractionhandler, elma" / & gt; & Lt; / SectionGroup & gt; ... and & lt; / ConnectionStrings & gt; & L

SQL - how to delete from one table while referring fom other table? -

How can I erase AT and AC from Table A while comparing two BPs of BP and BC BR = 1? Actually there is not the following work but should go in this direction, unfortunately I can not understand how ... Remove from one (AP = BP and AC = BC, where BC = 1) remove from one place (select BP, B to B, B = 1) where it exists (SELECT NULL FROM B WHERE BP = AP AND BC = AC AND BR = 1)

c++ - How do I use gcc builtin __sync_bool_compare_and_swap in g++ on MacOSX? -

मेरे पास कुछ कोड है जो इसका उपयोग करता है: __ sync_bool_compare_and_swap यह लिनक्स पर ठीक संकलित करता है। लेकिन जब मैं इसे जीओ ++ में मैकोज़क्स पर संकलित करने की कोशिश करता हूं, तो मुझे मिल जाता है: त्रुटि: '__sync_bool_compare_and_swap' को घोषित नहीं किया गया था यह गुंजाइश मैं इसे कैसे ठीक करूं? (यह मैक ओएसएक्स 10.5.8 है, इसलिए यह इंटेल है ..और इस अनुदेश होना चाहिए।) धन्यवाद! अगर आपको यह नहीं मिल सकता है, तो आप Mac पर OSCompareAndSwap () का उपयोग कर सकते हैं। लेकिन यह क्रॉस-प्लेटफ़ॉर्म कोड होना अच्छा होगा, क्या यह नहीं होगा ।

How to order, group, order with mySQL -

यह मेरी तालिका का सरलीकृत संस्करण है tbl_records -title -created-views < / Code> मैं सोच रहा हूं कि मैं एक क्वेरी कैसे कर सकता हूं जहां उन्हें शीर्षक से समूहीकृत किया जाता है, लेकिन प्रत्येक समूह के लिए दिया गया रिकॉर्ड सबसे हाल ही में बनाया गया है मैं फिर इसे विचारों के लिए आदेश देगा। मुझे लगता है कि एक तरह से एक उप क्वेरी करने के लिए और इसे बनाया द्वारा क्रम और फिर शीर्षक द्वारा समूह है और फिर उन परिणामों से दृश्यों के द्वारा आदेश मुझे लगता है कि हालांकि एक बेहतर तरीका है। धन्यवाद संपादित करें: नमूना डेटा: - शीर्षक: ग्नू डिज़ाइन -उपचार किया गया: 2009-11-11 14:47:18 -यहां: 104 -चिह्नः ग्नू डिज़ाइन किया गया: 2010-01-01 21:37:09 -उप दृश्य: 9- शीर्षक: फ़्रेंच कनेक्शन -सैटेड: 2010-05-01 09:27:19 -views: 20 मुझे परिणाम होना चाहिए: < पूर्व> - शीर्षक: फ्रांसीसी कनेक्शन -सैटेड: 2010-05-01 09:27:19 -प्रदर्शन: 20- शीर्षक: ग्नू डिज़ाइन -उत्पादित: 2010-01-01 21:37:09 -दृश्य: 9 < / कोड> केवल सबसे हालिया ग्नू डिज़ाइन दिखाया गया है और फिर परिणामों के

Notify users from my webpage that their browser does not have the latest update? -

I want to show a warning message to all of my logged-in users in my web application if their browser is not the latest version. So if they are using IE8 without the latest security patches, or if they are using Firefox 3.0 (instead of 3.5 or 3.6 at this point), or if the new version is stable, then the earlier version of Safari / Chrome Are using Check Out There are some constants for all different browsers and the current version. You can maintain a small database as a javascript file that contains the most current browser version and that you use from all your web applications.

java - What is a suitable lexer generator that I can use to strip identifiers from many language source files? -

I am working on a group project for my university which is being used for plagiarism in computer science . My group is primarily discontinuing the hashing / fingerprinting technology described in this magazine article:. This is similar to how the plagiarizing detection system works. We are basically taking the Kashmiri palm of the source code of fellow students and looking at them in a database for related matches (together with many adaptations, we determine that the document What hashes to choose as fingerprints). The first aspect of our project is its "front-end" section, which will have some semantic knowledge about each file format that our detection system process This will allow us to strip some details from the document which we do not want for the purpose of detecting plagiarism. Actually we want to be able to rename all the variables in different programming languages ​​for a different string or letter. What is a light solution (laser generator or someth

WPF: Animating in XAML, rather than C#? -

. I am creating a user control that stands three vertical wafer month calendar (Master, Slave 1, and Slave 2) Does. I want to hide the second and third calendar until the host window is not enough to show the entire month - no partial calendar. I have implemented this feature, which is going to trap the shape-sync event in an event handler in the code-behind: /// & lt; Summary & gt; /// Only shows the entire calendar - the partially visible calendars are hidden I /// & lt; / Summary & gt; Private Zero OnSizeChanged (Object Sender, SizeChangedEventArgs E) {// Enlarge the window height newHeight = e.NewSize.Height; If (NewHight> 500) {Slave Calendar 1. Visibility = visibility View; Slave calendar 2 Visibility = visibility Visible; } And if (Newhite> 332) {Slave Calendar 1. Visibility = visibility View; Slave calendar 2 Visibility = visibility Hidden; } Else {SlaveCalendar1.Visibility = Visibility.Hidden; Slave calendar 2 Visibility = visibility Hidden; }} I

xerces - Tomcat CLASSPATH -

I have a very troubling problem: My project (JSP, Servlet) Zersus-J 2.8 is required.1 or mostly but on our server (Tommak 5.5) AxS 2.6.2 always comes first and there is a serious error. I checked $ CLASSPATH and some clean-up though, Xerces 2.6.2 is still there. Can anyone tell me how to find out where 2.6.2 is? First, the environment variable $ CLASSPATH (and its Windows equivalent % CLASSPATH% ) ( java.exe in Windows) that any -cp - , -classpath and without is executed -or argument for this actual class Do not be confused in the form of that environment variable is forbidden as the (poor) feature for beginners only, which is the whole -cp or -classpath Muay do not want to type. According to your real problem, Tomcat also uses Xerces to Xerx to Xerx files internally as they are underlined. If you have full control over the server, what you can do best, as mentioned in the document, is to put the Xerces JAR file in the / normal / supported / fol

ruby on rails - Always use responds_to? -

I have always specified the response format for action using responds_to blocks, such as: of responses. Format | Format.js {Render: json = & gt; @record} And Recently I realized that if you only support a format (as in the example above), you really do not need that block Is it the best practice to leave it, or to remove it? I am going to isolate with the existing answer - I have responses for all my actions I have to block I think that, while a bit more verbose, it documents the documents themselves more clearly. This makes it easy to support additional formats in the future. Edit: This serves as a concierge. Any format declared in the block is not automatically "406 acceptable"

.net - View PDF file within ASPX not acrobat -

When a user clicks on a link, it opens a new window (after target = "_ blank" ) Calls a xyz.ASPX page that will dynamically create a PDF invoice, save it in the database (not a physical location), and then I should be able to open PDF file inside the ASPX page. What's happening now is that ASPX generates a PSD file, it does its stuff, but then the invoice opens to Acrobat to display the PDF However, the xyz.aspx page is empty And does not display anything. I do not like it and I want xyz.aspx to display the pdf file. From my research, it seems that if you want to display PDFs within the ASPX page, you need an IFrame or custom control. However, because PDF is dynamically created and not stored on disk, how can I set the source for iFrame? Is there a way to set source as a response object or some other in-memory object? Is there an easy way to do this? I do not want to use custom controls. I am using .NET 3.5 and C # along with master pages and CSS themes, but I h

Visual Studio 2008 C++ dependencies -

I am developing C ++ simulation (OpenGL) over the VS2008 environment. My current operating system is Windows Vista, the problem is that when Windows XP is trying to execute the application on the machine, my application crashes because the incompatibilities between DLL (i.e., msvcrt.dll function entry point) ... Does anyone experience such a problem? I seriously doubt that this is the real cause of the crash. You probably have not posted CRT libraries in the target machine or deployed the debug build. If this is a single EXE that does not have any DLL dependency then solve your problem by adding a static version of CRT. Right-click on Solution Explorer, Property, C / C ++, Code Generation, Runtime Library, Project / MTD, repeat for release configuration, now select / MT.

sql server 2005 - How to add Row_number to table function results -

I have a function that gives a group (cluster) from a table. Create function dbo.ftAllClusters () Select the different cluster from the company as the return table in the form of the return Now I need to add the line number for each line .. < / P> select cluster, ROW_NUMBER () over (order of cluster) AS RowNo FROM (related to company Select cluster) x ... select cluster, ROW_NUMBER () over (order of cluster) AS RowNo FROM COMPANY GROUP by cluster

Count how often the word occurs in the text in PHP -

In PHP I need to load a file and get all the words and resonate the number of words and each word shows In the text, (I also need to show them in the most commonly used words in the order downward) ★ ✩ itemprop = "text"> Here's an example: $ text = "A great text lesson. If you are in Unicode, think about it. Rchha will. " // $ word = str_word_count ($ text, 1); // Use this function if you only want the word ASCII $ = utf8_str_word_count ($ text, 1); // If you take care about i18n $ instance = array_count_values ​​($ word), use this function; Arsort ($ frequency); Echo '& lt; Pre & gt; '; Print_r ($ frequency); Echo & lt; / Pre & gt; '; 2 [if] = & gt; 1 [About] 1 in [in] => 1 [Unicode] = & gt; 1 [thinking] => 1 [to] = & gt; 1 [many] => 1 [únÌcÕdë] = & gt; 1 [text] = & gt; 1 [anything] => 1 [A] = & gt; 1) and utf8_str_word_count () function, if you need it: function Utf8_st

ruby - Rails class name/type not working for a polymorphic has_many :through -

I have an invoicing system that manages debits and credits. Invoice amount is originally received from the amount of its debit and the balance takes its credit and deducts it from the total amount. I am doing it with four models. Line Item Debit Credit By the way It works through an inserted model (line item), which is called a polymorphic association, which is called recordable. At first glance, everything seems to work properly However, inspecting the line object indicates that the recordable_ID looks fine, so the recordable_type is zero. There is a section of code here: class invoice & lt; ActiveRecord :: Base is - Medium: Line_Entems, Dependent = & gt; : Has_many deleted: debit, through: = & gt; : Line_tyme, as in: = & gt; : Is recordable_image: credits, through: = & gt; : Line_tyme, as in: = & gt; : Recordable End Class LineItem & lt; ActiveRecord :: Base is_to: Invoice is_to: recordable ,: polymorphic = & gt; The truth is incl

bash - how to remove command line color highlighting of Vista Samba shared directories in Ubuntu? -

I have a Vista share that appears in Ubuntu, but I want to highlight the Bash color on the directories / files I was a local directory / file It is not I Bash, but LS environment variables LS_COLORS ls For colorization behavior determines on my machine: justin @ info-density: $ $ echo $ ls_COLORS not = 00: fi = 00: di = 01; 34: ln = 01; 36: pi = 40; 33: So = 01; 35: do = 01; 35: bd = 40; 33; 01: CD = 40; 33; 01: or = 40; 31; 01: su = 37; 41: sg = 30; 43: tw = 30; 42: ow = 34; 42: cents = 37; 44: East = 01; 32: .tar = 01; 31: .tgz = 01; 31: .svgz = 01; 31: .arj = 01; 31: .taz = 01; 31: .lzh = 01; 31: .lzma = 01; 31: zip = 01; 31: .z = 01; 31: .Z = 01; 31: .dz = 01; 31: .gz = 01; 31: .bz2 = 01; 31: .bz = 01; 31: .tbz2 = 01; 31: .tz = 01; 31: .deb = 01; 31: .rpm = 01; 31: .jar = 01; 31: .rar = 01; 31: .ace = 01; 31: .zoo = 01; 31: .cpio = 01; 31: .7z = 01; 31: .rz = 01; 31: .jpg = 01; 35: .jpeg = 01; 35: .gif = 01; 35: .bmp = 01; 35: .pbm = 01; 35:

java - How to determine the exact state of a BufferedReader? -

मेरे पास BufferedReader ( new BufferedReader (new InputStreamReader (process.getInputStream ())) )। मैं एक BufferedReader की अवधारणा के लिए काफी नया हूं, लेकिन जैसा कि मैंने इसे देखा है, उसके पास तीन राज्य हैं: एक पंक्ति पढ़ने की प्रतीक्षा कर रही है; कॉलिंग bufferedReader.readLine इस स्ट्रिंग को तुरन्त वापस कर देगा। स्ट्रीम खुली है, लेकिन पढ़ने की प्रतीक्षा करने वाली कोई रेखा नहीं है; कॉलिंग bufferedReader.readLine एक पंक्ति उपलब्ध होने तक धागा लटकाएगा। स्ट्रीम बंद है; कॉलिंग bufferedReader.readLine शून्य पर लौटाएगा। अब मैं BufferedReader की स्थिति निर्धारित करना चाहता हूं, ताकि मैं यह निर्धारित कर सकूं कि क्या मैं अपने आवेदन को लटकाए बिना इसे सुरक्षित रूप से पढ़ सकता हूं। अंतर्निहित प्रक्रिया (ऊपर देखें) कुख्यात अविश्वसनीय है और इसलिए शायद लटका हो सकता है; इस मामले में, मैं अपने मेजबान आवेदन को लटका नहीं चाहता इसलिए मैं एक प्रकार का टाइमआउट लागू कर रहा हूँ मैंने पहले यह थ्रेडिंग के साथ करने की कोशिश की, लेकिन यह बहुत जटिल हो गया। कॉलिंग BufferedReader.rea

How can I print a variable and its value with just core Perl on RedHat? -

I'm trying to create a simple sublanguage in Perl, which does not use any module standard Redhat Linux distribution is better in other words more portable because I'm always working in the system environment, I can not control it. The obvious problem is giving the alias the variable so that both the original variable name and value can be used. I can get one or the other but can not figure out how to do both without the more complicated input for the sub call, as I can pass a string and a reference as shown below but it is almost normal It would normally be messy in the form of a printing: print "\ $ A = $ a \ n"; There are potential opportunities problems but one step at a time. Now I am thinking that this is not easy. (Yes it's a lazy programmer code that I'm looking for) example pseudo code: my $ a = 1; My $ secondVar = "something new"; My $ XXX = 12345; # Print the list of variables of easy interest to read # listings with at lea

iphone - How do I really know when a UIButton has been released? -

I am running on an issue where I have a UIButton in which I want to track press / release events so I I'm attacking touch-down / touch-up events. Unfortunately, in some cases this will not track the touch up event - for example, if a warning pops up. - (IBAction) Button: (ID) sender; - (IBAction) Button: (ID) sender; How do I ensure that the view controller is notified when the button gets pushed / normalized, what is the reason for any reason? You must also track the touch cancel event. Should do this. Edit: Hmmm, what about UIControlEventAllTouchEvents ? You have to add it programmatically. I'm really surprised that it was not canceled. You can also try to cancel the - (zero) touch: (NSSet *) touches the event: (UIEvent *) Event in your UIViewController [myButton addTarget: self action: @Silterar (for all tactics) control events: UCentral eventsAlatouvents]; Great

c - Symbols like _sqlite3_open not found error -

Hello I am getting this error: Undefined symbols: "_sqlite3_open", referenced from: _main In ccRlWVer.o "_sqliite3_close", referred to: "_sqlite3_exec" in ccRlWVer.o, referred to: _main, in ccRlWVer.o, referenced from "_sqlite3_errmsg" _main, _main ccRlWVer.o in "_sqlite3_close", referenced from: ccRlWVer in _main . O LD: Symbol (s) not found Collection 2: Exit status of LD back 1 This is my code: const char * filename = "database. Db "; Sqlite3 * ppDb; Int rc; RC = sqlite3_open (filename, and ppdb); If (RC) {FPrintf (stadder, "can not open database:% s \ n", sqlite3_errmsg (ppDb)); Sqlite3_close (ppDb); Exit (1); } Four * errMsg = 0; Sqlite3_exec (ppDb, sql, display_result, 0, and errMsg); If (rc! = SQLITE_OK) {fprintf (stderr, "SQL error:% s \ n", errMsg); } Sqliite3_close (ppDb); Return 0; You have to pass the library in this situation, with which you want to link your code Are it sqlite

php - Does naming your form fields the same as mysql actually pose any security risk? -

Is there any reason why you should name your form fields as HTML fields or not? & lt; Input type = "text" name = "my_field_1" id = "my_field_1" /> - & gt; Mysql line my_field_1 or & lt; Input type = "text" name = "myField1" id = "myField1" /> - & gt; Mysql row my_field_1 I can think that only one thing is probably naming conventions for HTML versus MyScall (personal preference), as well as prevention of minor injections (obviously the area's Name must be changed too much ... but all the values ​​must be valid before also + use the real escape strings.) The only way I can see that it can cause a problem when the attack A common table identifies the name of a protected column that should not be changed through the form, and intends to have a new input element with that name, "slipping" illegally in the table. This is a program that should filter your program in any w

c# - Multiple User Controls referencing the same object -

I have created a UserControl in C # on which I have inserted a datagrid view. When I have only one instance of this UserControl in the WinForms project, then it works like this when I have two examples of this user control in the WinForms project, the second example of my user control behaves in a way that way It should be from, but not the first. It looks like an example of both usertransternal instances Many thanks in advance. Have you unearthed a property on user control that sets / receives gridview's data source is? (You can not do this in user control or you will see the behavior you are viewing)

c# - Retrieving antivirus info -

How can I drag the names of the installed anti viruses from WSC and if the virus database needs to be updated or updated? The solution is for query about the status of installed antivirus win32_antivirusproduct . There is actually a detailed article about the topic that will help you. It's in vb.net but you can just translate a few lines. Renewed link:

arrays - Ruby: catching access to variable inside class -

I have a class that creates an incoming string in nested strand cascade For an input abcde , this will generate an [[[[[[[[[[[[[, [a, b], c], d], e] . Now, if I use any set of top level values ​​for waterfall , then [] = (index, value) The law of my class will apply. See the examples given below, where to see the X [0] [0] , see the examples below. Code> does not explicitly apply a class method [] = . So, is it possible to gain access within class method (or at least in a different way)? class MyClass attr_accessor: cascade def initialize string build_cascade string.split (//) end def build_cascade array if array.length & gt; 2 array [0] = array [0..1] array.delete_at (1) build_cascade array and @cascade = array end end def [] = (index, value) puts 'you' \ '+ value.to_s +' \ 'For \ "' index.to_s + '\' Cascade! ' Enddef [] (index) @cascade [index] and end x = mylcels.new ('ABCDFghigak') x.inspect x [0] = 5 # =

django forms error_class -

Is there a way to provide a specific error in the function in fire defragment? Under the docs, it shows that you can give a form a special error rendering function, but it seems like you have to declare when you have the form, not when you have an illustration of defining it. You can define something like ErrorList class: Import ErrorList class DivErrorList (ErrorList) from django.forms.util: def __unicode __ (self): Return self.as_divs () DEF as_divs (self): Otherwise self: return you 'U' return U '& lt; Div class = "errorlist" & gt;% s & lt; / Div> % '' .join ([U ' < P> And then when you have an explanation of your form, you can illustrate this with error_class: f = ContactForm (data, auto_id = false, error_class = DivErrorList) f.as_p ( ) & Lt; Div class = "errorlist" & gt; & Lt; Div class = "error" & gt; This field is required. & Lt; / Div & gt; & Lt; / Div & gt;

mysql - Why is a "GRANT USAGE" created the first time I grant a user privileges? -

I'm new to the admin side of DBMS and tonight I was using a new database (MySQL) when I saw . After giving the user privilege for the first time, another grant has been made, which is <*> on * GRANT USAGE. * Password is user-recognized by password Documentation says that USAGE is the privilege "has no privilege," so I tell that sequential As indexes work, and probably the user will have any kind of privilege for all databases, so does it work as a grip? I also do not understand that this line has a recognized section, when the grant made by me is not (mostly because I do not understand this Now that is identified edit: Sorry for not being told basically, grant database Allow all authority over. * Allow, Submit, Update, Delete on Database for Admin_user For the user, As you said, MySQL USAGE The USAGE privilege specifier has" no privilege. "It is used globally to affect current account privileges Account attributes, such as r

Tomcat, Groovy and clean urls -

I am trying to run inside Groovy Tomcat with a clean URL. Since my knowledge of Tomcat's URL mapping and filter is quite limited, so I'm walking in a brick wall. What do I need to do index.groovy called FrontController which handles incoming requests The problem is that I can not understand that the correct web.xml How to create a mapping I currently have (which is a lot more standard): & lt; Servlet & gt; & Lt; Servlet-name & gt; Groove & lt; / Servlet-name & gt; & Lt; Servlet category & gt; Groovy.servlet.GroovyServlet & lt; / Servlet category & gt; & Lt; / Servlet & gt; & Lt; Servlet-mapping & gt; & Lt; Servlet-name & gt; Groove & lt; / Servlet-name & gt; & Lt; URL pattern & gt; / * & Lt; / URL pattern & gt; & Lt; / Servlet-mapping & gt; If I try to use my URL now with the URL, then I get a 404 . http: // localhost: 8080 / grooveist / index.groovy / test Of

matrix - Isometric projection : What's wrong with my math? -

I have a math problem in Iometric launch I have read an article: for Isometric projection part, it is a Gives the mathematical formula in the 2D point for the x part: x '= (x - z) cos (30); But I also check for wiki, so I use rotation matrix which is giving the wiki, calculating itself x ' = X * cos (beta) - z * sin (beta) Beta wiki (Y axis is defined by rotation angle, and it should be 45). So what's wrong in my math? Or is there something that I do not know about isometric projection? Are you sure your cos and sin degrees and not radians? // c / c + code # defined pi 3.141592654 static constant float pi_radines = pi / 180 f; Inline Float Digotrade (Float A_Cagrace) {Return (Aadgrids * PI_Radiens); } Inline float redout (float_adedia) {return (A_Redian / PI_ radians); }

reporting services - How to reference in SSRS report (in client mode) objects from application -

I have a report created in SSRS mode, which is disconnected: I create a data source in the code and pass it I am reporting it as a dataview, it works fine. But I need to be able to get my project enabled in reference to some objects (variables, whatever): Which are not calculated based on the data in the report. As the report shows total sales over a total period, with its total, but I need to display the field in the report footer - last month total (in fact they are about 10 other "previous" total). I need to show / hide some columns based on some settings in the application (for example, I have an application option: Show previous month sales) Any idea how to do it? Thank you Q1-> to use the data in your report You must specify the data inside the data source object. You can not use variables only, if that were your intentions. So yes, you're doing it right. *** Sorry, you can theoretically use report parameters for this. Q2-> The real

sql - How to create view to calculate currencies? -

मेरे पास निम्न तालियां हैं: उत्पाद उत्पाद, idcurrency, मूल्य Prod1 1 5000 Prod2 2 3000 Prod3 3 2000 Currrency idcurrency, currencyID 1 यूरो 2 अमरीकी डालर 3 DKK ForexExchange idforexExchange ProviderName, idbaseCurrency, isActive 1 XE Eur 1 2 provider2 DKK 1 ForexRates idForexRates idforexExchange, toCurrency, exchangeRate 1 1 एईडी 2.3 2 1 EGY 1.3 3 1 जीबीपी 2.4 4 2 एईडी 7.3 5 3 ईजीवाई 6.4 6 4 जीबीपी 3.4 मुझे सक्रिय मुद्रा के लिए यूएसडी डॉलर में सभी उत्पाद प्राप्त करना है। - सभी मुद्रा दायर की गई लुकअप तालिका से संबंधित Currrency- हमारे पास विदेशी मुद्रा एक्सचेंज टेबल है, इसलिए यदि हमारे पास एक्सचेंज दरें के लिए कई प्रदाताओं हैं तो हमें बेस मुद्रा के अनुसार प्रत्येक एक्सचेंज के लिए मुद्राओं की दरें मिलती हैं - विदेशी मुद्रा तालिका प्रत्येक के लिए दर को बचाती है एक्सचेंज - हम सक्रिय एक्सचेंज से सक्रिय एक्सचेंज सेट कर सकते हैं, इसलिए इस एक्सचेंज रेट टेबल का उपयोग सिस्टम में किया जाएगा अपेक्षित परिणाम उत्पाद मान मान यूएसडी prod1 5000 25000 .... ........... यहां हम

C/C++ bitfields versus bitwise operators to single out bits, which is faster, better, more portable? -

I have to pack some bits into byte in this byte: struct {char} Bit 0: 1; Four bit 1: 1; } a; If (a.bit1) / * etc * / or: if (a & amp; 0x2) / * etc * / It is very clear from the source code that bitfield knit is but the option is fast? I know that the speed difference will not be too much if any, but as I can use any of them, if one is fast, then better. On the other hand, I have read that BitField does not guarantee to arrange bits, they want to order the same platforms, and I want to make my code portable. Note: If you want to reply to 'profile', I will, but as I am lazy, if someone already answers, very good. The code can be wrong, you can correct me if you want, but remember what this question means and please try and answer it too. I will use the second instance in priority for maximum portability. As Neil Butterworth pointed out, BitField is only used for the original processor. Okay, think about this, what happens if Intel's X86 is out of bus

c# - Webclient UploadData returns error 417 even after putting expect100Continue to false -

Hi guys are trying to upload a tweet from my application and when I do a webclick upload it gives a webexctions "remote server returned an error: (417) expected failure." Looking around the net After, I think people expect that it will do false work to do 100 jobs, seeing my code I already had the snippet in my code. Does anyone else know why this is not working? This is my code. Public Bull Postatet (string tweet) {string aUrl = "http://twitter.com/ conditions / update.xml"; Client.Credentials = New network credentials (_username, _password); System.Net.ServicePointManager.Expect100Continue = false; Byte [] tweetBytes = System.Text.Encoding.UTF8.GetBytes ("status =" + Tweet); Client.UploadData (aUrl, tweetBytes); Back true; } Hope this is helpful, and thanks in advance < P> Try to create webcallint instanse after you believe Expect100Continue is wrong.

java me - Sorting a hashtable based on its entry value (not the key) -

I have to work the following code in the Java ME / J2ME environment. Please help: Hashtable This does not work, I get an error: Exception to "main" java.lang.ClassCastException thread: java.util.Hashtable $ Entry can not be entered in java.lang. This code, which I have indicated in the code, with a comment, using I J2me! The code you received is not anywhere valid J2ME, it is full fat (J2SE) Java; J2ME currently has no generic, or collections class or comparative interface - check Java Dock for and for components of J2ME Your error mentions those people, so definitely J2ME did not come from, which suggests that you are doing fundamental mistakes in your project setup? If you want to do it in J2ME, you should work yourself one type, because as far as I can not tell such a thing exists. Writing bubbles will be easy, because the only way is that you can easily access sequential members of the hashtable through Enumerations (via scores.keys () and scores.values

C# -> Updating an AppSettings.config file on Win7/Vista -

I can not see anything here but I remember that if you want a file to update a file So it must be under ... ** C: \ Users \ Ibrar Mumtaz \ AppData ** OK somewhere, the reason is That the user should have permissions to update a config file here and should not be under the application install folder. It is a belief that I am down and I am sure that this is definitely the case. As I think I have read that here P = My question is, is there anybody who can highlight some light on this because this is my previous feature which I have given my application I want to apply it first test. 1) The first thing is that installing the folder requires an installer and after that my application leaves the config file in it. I'm already using the Visual Studio installer, So my app has been packed but this thing is throwing me? How do i do this I just need to show someone how to do this and I should fix my app to look for the new home of the config file. 2) I should be able to find o

css - Is there a useful purpose for <style type="text/javascript">? -

What is its use and purpose, is it useful? This is for "JSSS", or javascript style sheet ; See for more information, it is nonstandard and has never really been caught out of Netscape's original offer, which you can read I do not think most browsers today Support it; I have definitely never seen the website that used it.

amazon s3 - Cloud storage - How long is data kept? -

I'm looking at Amazon S3, but I can not find anything, use of t etc. That's why I believe that it is kept forever, but it seems a bit absurd. Any thoughts? Thanksgiving :) itemprop = "text"> per GB S3 charges for storage (although not much) so long as you By the time they are paying, they are storing. Check out their pricing charts. Hopefully most people will use it for data transfers using S3 - this is what cares about Amazon, not only storage, which is very cheap. Therefore, they make their money on bandwidth (and besides, on other services which interact well with S3). Of course, they do not guarantee that your data will always be there if you are there. See for specific information about data retention policies. Disclosure: I am a former applicant employee.

entity framework - Malicious input in ASP.NET MVC -

I have ASP.NET MVC 1.0 and unit framework v1 application. By default, the submitted content is valid for user malicious input (see). HTML encoding prevents user submitted data, JavaScript injection attacks. The unit framework uses internally paramLated SQL which will prevent SQL injection. Is it enough? Please advise. Thank you. prevent over-posting problems Use the Bind (Include ... feature). Check out this link for more information: Hope this helps. < / Div>

mysql - PHP custom CMS and SEO -

There are custom CMS for the launch of the launch arts center in my city. I have site through artists / events / media etc. But in the PHP / mysql I created the interface. My question is to do with Google indexing and CMS content. Obstacles will not be able to remove the archived show (which will have a URL like: calendar_expanded? Id = 310 ), but if they do, the page will display the small blauer that will allow the person to access It is a record that it is no longer present, or has never been done SEO and file calendar_expanded.php and how it comes to Google and other search engine indexes So, what should I worry about? Thanks in advance, J. Edit What's going on here is that I want to search No The engine gets a 404 error from the site. If the page is not suddenly available with the empty URL because people suggest that I have to implement some methods for permanent redirection .htaccess? Ensure that you send the client the right to tell the status of the

java - Creating beans on-demand using spring -

I want to make some spring beans after the startup in the factory-eye pattern. For example, every time I have to do some work and I need to make a work bean (which is probably dependent on other singleton spring beans) and execute it. There may be many pieces of work to work on here Also, each work bean requires independent (prototype). Do any similar patterns people use to achieve it? As I see, I want to do container / applicationContext in any way but I really do not want to call the applicationContext / beanFactory scatter injection and everywhere BBA ("...") Am I thought of something like this (note "factory" is something I imagine, something exists instead) << xxx: factory bean = "mytask"> And then the code class MyTaskExecutor {Private factory jobs; Public Zero SetTexFinancial (Factory Taskfiner) {this.taskFactory = taskFactory;} } and perhaps an annotation session class MyTaskExecutor {@Factory (MyTask.class)

c# - reflecting changes made to the datagrid back on the dataset and the datatable -

I have a datagrid that has a dataset and its dataset is a table from the database in the dataset. I need this when I change the cell values ​​in the datagrid, the changes should reflect back on the database. The thing is that these changes appear on the dataset, but when I use da.Update (ds, "TableName") to forward that change to the database, it does not work. Datagrid still shows the old value, although the datagrid and dataset shows the update value. I have used the da.Update () command at other places in the same program twice and it starts working properly and the database shows updated values. I do not know Watts who does not work at the moment. The surprising thing is that I am not getting any errors, the code runs properly, but no changes have been noticed in the database. Edit Edit: In fact, what I am doing is selecting a line from a data grid and then displaying all the text values ​​from that line on the text box. I am doing So I am editing those values ​​a

Receiving java.sql.SQLException: out of memory -

I got this error message in Netbeans 6.8: Exceptions in thread "main" Java .sql.SQLException: org.sqlite.DB.throwex (DB.java, 2002) at org.sqlite.NativeDB._open on memory (the original method) on org.sqlite.DB.open (DB.java:77 ) Org.sqlite.Conn on Java.sql & Lt; Init & gt; (Conn.java:88) at org.sqlite.JDBC.connect (JDBC.java:64) on Java. .sql.DriverManager.getConnection (DriverManager.java207) on Jr.DriverManager.getConnection Java (DriverManager.java tips82) I have changed my VM option but still get error. How can I fix this? Without a code snippet, it is difficult to give a decent answer, after going for this exception, It seems that many people have faced this problem. If you try to remove the drive name (if any) from the JDBC URL, it can help.

html - Display data in columns not rows using Ruby on Rails -

I would like to display data in columns instead of rows in my web page Ruby on Rail What is the most effective way to use it? Many thanks for your help! Using an array will be a simple solution to rotate the information. Like this (pseudo) code (can not check ATMs) Controller code: @stuffs = Stuff.find (: all) @rotated = [] @ rotated [0] = [] #Stuff Column 0 @ Rotate [1] = [] #Stuff Column # 1 Index Index = 0 # Now Easy to Store (ier) Access @ stuffs.each do | @ Rattified [0] [index] = content.formatt0 @ breadcrumbs [1] [index] = content.extension1 index + = 1 end In your view, you need something like this: / P> & lt; Table & gt; Table head here! & Lt;% 2.times do Row | & Gt%; #Bild tables (we have 2 luggage details, so 2 here) & lt; Tr & gt; & Lt;% index.times | Column | & Gt%; & Lt; Td> & Lt;% = @rotated [row] [column]%> & gt; & Lt; / Td> & Lt;% end% & gt; & Lt; / TR & gt; & Lt;% end

php - Zend Mail - bouncing mails not returning to the specified "Return-Path" -

I am working on a simple mail list app in PHP using Z Mail. The idea is that all mails bounced are redirected to a script that processes them and a report is prepared. This script is fine running in direct testing, but I have tested it with fake mail address to test the mail list app, and it appears that the mail is not being redirected to the correct email address. Zend provides setReturnPath method to set the "Return-Path" header, is it okay to use this header for this purpose? Thanks

wxpython - Trying to run a Python program but all that opens is a DOS Window -

I have just completed a program which is expected to play a GUI program. I have cleared all syntax errors, but now when I double click, or run a program from a command prompt, a dos window runs less than the other and never disappears without running the program She goes. What's going on? This is a link to code at codepad.org possible is dyslexic and is an excellent programmer at the same time, but it does extra effort and hard work on your behalf. Equipment may be of some help as well, though they have limitations. Edit : As it turns out, in the sqaure class , the program is running - and immediately "Game" Over ", and if your code becomes the last line in the form of raw_input , then there should be one or more dirty logic-level bugs beyond many typo.

iphone - What keying option does the keychain use? -

I have read in a keychain and found that it uses triple DES, what I can not find The keying option that uses it, I'm guessing / hoping that its keying option is 1 where all 3 passwords are unique, but if this case only I can think about two passwords that it can use (User password and app id The programming comes from your dev certificate) third coming? Is this an important personal to Apple? If its keying option is 2 (the first and the third key is the same) then it may not be enough to rely on our company. Although it can be crazy, I have to make sure my security department is safe enough that it is safe enough. There is no answer as yet, I thought that what I have found so far There may be an opportunity to respond. I have seen available for OS X Chichen and although I do not believe 100% because there is a lot of it, key bunch API Classes -> KeyTime uses 3DED on Line 141 on CPP . At least this DES and DDES are used for this class. . Many private classes are miss

multithreading - Do lock objects in Java need to be static? -

I know in C # when you have an object that you want to use as a lock for multi-threading You must declare it stable inside a class, which class instances will be running in different threads. Is this also true for Java? Some examples online only begin declaring the last object as a lock object ... EDIT: I have a resource that I want to limit to only one thread access at a time. A class that extends the thread will be used to create many instances and will start at the same time. Thanks Depending on which context they are used they will be used. If you want a per-instance lock, go away still . If you want a per-class lock, use still in addition to actually put it the last .

sql server - Re-writing this sql query -

I have written a SQL query that receives unread messages but I think I will code (speed and readability) Can improve The first selection is for the COUNT function, the second is to group message according to chat_and, and the last nested selection is to select previous messages. Please suggest me in advance thank you. SELECT COUNT (*) as unread (SELECT id FROM (SELECT id, conversation_id message WHERE to_id =? And read = 0 and NOT hide_from =? ORDER by SECRED DESC ) As temp_messages2 as a query) by AS temp_messages group - You need to define all the columns which are not wrapped in the set in GROUP BY . This is not clear, but if you want to count specific conversations, use it: SELECT COUNT (DISTINCT m.conversation_id) messages unread WHERE m.to_id =? And m.readed = 0 and m.hide_from! =? ... Otherwise, use: SELECT COUNT (*) As messages have been unread with WHERE m.to_id =? And m.readed = 0 and m.hide_from! =? Subkeys are unnecessary ORDER BY is a was

jquery - Add new items to a Html selectbox -

Can I check in the html selection box for existing items, while adding them The user types a text in an input box and then clicks the button to add the item. But before I connect, I want to check identical objects, is there an effective method of writing this script? if $ ('# dropdown option [Value =' + newoption + ']') An option returns or not. Example if ($ ('# dropdown option [value =' + new + + ']'). Length & gt; 0) {// options exist . } And {// options do not exist}

java - What is exactly is Ajax request? Is it different from Servlet Request? -

Can anyone tell me what the Ajax request really is? Is this sublett different from the request? An Ajax call is an indefinable request that resulted in a direct page transition launched by the browser. The request is a java-services term (servlet is a java specification), which is to serve an HTTP request, which can get a simple GET or POST (etc) or an Ajax request. An Ajax ("asynchronous JavaScript and XML") request is sometimes called an XHR request ("XmlHttpRequest"), the name of the object used to send an Ajax request to most browsers Because at least initially Ajax is involved in sending and receiving calls, but now it is just fine as it is common to send / receive JSON, plain text or HTML. A good example of Ajax request is the comment system on the Stackworflowflow, you can enter a comment in the text box and click submit. It does not store the entire page (like a traditional HTML form is stored, which is usually translated into a post, but someti

How to run MATLAB code from Java? -

I am facing problems running Java from MATLAB code. If you know something on this, can you help me? If you do not want to purchase MathWork's MATLAB Builder for Java Toolbox, you can use MATLAB's undocumented JMI ( Java-MATLAB interface). Find the CSSM News Group (or Google) or JMT link for JMI which is based on JMI. The MATLAB code itself is full of examples of JMI usage - using the MATLAB editor's search tool, search the entire MATLAB installation on "jmi" Note that JMI is neither a document nor officially supported by MathWorks. In addition, if used improperly, it can hang or crash your app. But unlike Toolbox, it's free.

mySQL return not empty field -

I have two fields, but I just want to return empty-empty one. First name, choose last name, (if firstname! = Empty, then first name and last name) names from users; How can I go about doing something like the above? I'm not sure what should be inside the round bracket. I do not want to use PHP post processing. Both the null values ​​along with the empty string ( '' ) Select IF (LENGTH (first name), first name, last name) as the name from users;

c++ - Is it recommended to trap SIGPIPE in bash script? -

I have a problem while executing a script from C ++ using the system call command in the script SIGPIPE < / Code> signals and returns with exit code 141 . This problem is only visible in the last release of my code. My question is as follows: Why does this sympathy come now and before that it did not happen? Is it safe to ignore SIGPIPE and what are the outcomes? 1) It is not at all obvious that to answer the changes you made It is very difficult to 2) If a sequence of orders appears in a pipeline, and before the completion of the author a reading order is completed, the author receives a signal CPI signal. So you can ignore it, it depends on whether it is acceptable behavior for your script or not. More info

xslt - 'charset=UTF-16' is missing in the transformation result with MSXML4.0 -

I have some problem about" Charset "in the change result with different versions of MSXML. The With MSXML3.0 code below HTML will transform XML dim xmlDoc New MSXML2.DOMDocument xmlDoc.async = false dim strXML string strXML = "& lt as as result & gt; & lt; ElapsedTime & gt; & from 3000 lt; / ElapsedTime & gt; & lt; / result & gt; "XmlDoc.loadXML (strXML) new Msaksmel as dim Aksseldik 2 Kfri Threddeddommaks XslDoc.async = string Strks Selel as string Selel = "C: \ Test.akssel" xslDoc.load (strXSL) dim XSLT new Msaksmel 2. XSL template xslt.stylesheet = as xslDoc as xslProc dim MSXML2.IXSLProcessor xslProc = xslt.createProcessor xslProc.input = xmlDoc xslProc.transform () Debug.Print (xslProc.output) < P> ========== ============================== " Test.xsl "is the content of, =============================== This Output is, & lt; Html & gt; & Lt; Top & gt; & Lt; META

css - Common Web UI Styles -

I have to present one prototype of a web app in the following days to any one of my clients, this is Not so good on CSS and worst I'm almost never happy with getting results. Coding business logic is not a challenge for me, UI design though takes more than 80% of my time. I'm not breathtaking, just do not need a clean, good and dignified environment, example: This is a recurring problem I'm seeking, I want web UI development Less nude default style , an approach similar to Visual Studio or iPhone SDK will be very useful to me. The mask above is a great example with Balsamiq Mockups , all the most common "components" are available to use, and are the best: to choose from There is only one good style Is there anything like this for the web? Options: I'm interested in knowing if there is a CSS-only UI framework. I found, but most of them seem to be typical for Java (at least the best), are there equally g

c++ - Can we use a timer for itself? -

Actually this is what I have to do; When a situation is seen, my program will stop itself and it will open again after five minutes. Is it possible with only one .exe - using any OS property -? I do it with two .exe if (close to turnkey) {// call secondary program system ("secondary.exe"); Return (0); } And my secondary program only waits for five minutes and makes primary calls. main () {sleep (300000) // sleep minutes for five; System ("primary .exe"); Return (0); } I want to do this without a secondary program. (sorry for bad english) You can use it with an application Can be done if a switch is given (like myapp.exe / startme ). The system () is a synchronous call, it only happens when the command run is over. The Wi-Fi only has what you are looking for. You can also follow the instructions to set your time using the OS to employ your job. But, depending on what you are trying to achieve, a better solution may be to hide you

c++ - Why am I getting a segmentation fault? -

I am trying to compile a simple Hello World function in C ++, after compiling it, Run and get "segmentation fault" Can anyone put some light on it? I am compiling it using the Linux Command Line using the following command: G ++ hello.cpp #include & lt; Iostream & gt; using namespace std; Int main () {cout & lt; & Lt; "Hello world!" & Lt; & Lt; Endl; Return 0; } The program itself looks fine, I think your compilation environment has some fun That is happening due to the Sigfault. Your best bet is to run it in Debugger (GDB) - it will tell you that it is crashing, which will help you to understand what is the problem. To do this, compile it like this: G ++ -GO hello.cpp Then run gdb: gdb hello and at gdb prompt run To run the program when it crashes, type bt which will give you a stacktrack that will hope - you know What will happen is going on.