Search Results

Search found 25343 results on 1014 pages for 'write protect'.

Page 56/1014 | < Previous Page | 52 53 54 55 56 57 58 59 60 61 62 63  | Next Page >

  • How do you protect your <appid>.appspot.com domain from DDOS attack?

    - by jacob
    If I want to use CloudFlare to help protect my GAE app via it's custom domain, I still am vulnerable to attacks directly on the .appspot.com domain. How do I mitigate that? I could force redirect appspot.com host requests, such as discussed here: http://stackoverflow.com/questions/1364733/block-requests-from-appspot-com-and-force-custom-domain-in-google-app-engine/ But I would still suffer the load of processing the redirect in my app. Are there any other solutions?

    Read the article

  • Can I write this JQuery statement cleaner?

    - by Polaris878
    Hello, So I have the following: var box = $(".MyCheckBox"); if (box[0].checked) { // Do something } else { // Do something else } Is there a better way of doing this using filters or something? I know I can go: $(".MyCheckBox") .filter(function(index) { return this.checked; }) .each(function() { // do something }); But I need to do something in the else statement... easier way of doing this? Thanks!

    Read the article

  • Write the longest possible loop.

    - by Abhay
    Hello Group, Recently I was asked this question in a technical discussion. What is the longest possible loop that can be written in a programming language? This loop has to be as long as possible and yet not an infinite loop and should not end-up crashing the program (Recursion etc...) I honestly did not know how to attack this problem, so I asked him if is it practically possible. He said using some computer science concepts, you can arrive at a hypothetical number which may not be practical but nevertheless it will still not be infinite. Anyone here; knows how to analyse / attack this problem. P.S. Choosing some highest limit for a type that can store the highest numerical value is apparently not an answer. Thanks in advance,

    Read the article

  • How do I write recursive anonymous functions?

    - by James T Kirk
    In my continued effort to learn scala, I'm working through 'Scala by example' by Odersky and on the chapter on first class functions, the section on anonymous function avoids a situation of recursive anonymous function. I have a solution that seems to work. I'm curious if there is a better answer out there. From the pdf: Code to showcase higher order functions def sum(f: Int => Int, a: Int, b: Int): Int = if (a > b) 0 else f(a) + sum(f, a + 1, b) def id(x: Int): Int = x def square(x: Int): Int = x * x def powerOfTwo(x: Int): Int = if (x == 0) 1 else 2 * powerOfTwo(x-1) def sumInts(a: Int, b: Int): Int = sum(id, a, b) def sumSquares(a: Int, b: Int): Int = sum(square, a, b) def sumPowersOfTwo(a: Int, b: Int): Int = sum(powerOfTwo, a, b) scala> sumPowersOfTwo(2,3) res0: Int = 12 from the pdf: Code to showcase anonymous functions def sum(f: Int => Int, a: Int, b: Int): Int = if (a > b) 0 else f(a) + sum(f, a + 1, b) def sumInts(a: Int, b: Int): Int = sum((x: Int) => x, a, b) def sumSquares(a: Int, b: Int): Int = sum((x: Int) => x * x, a, b) // no sumPowersOfTwo My code: def sumPowersOfTwo(a: Int, b: Int): Int = sum((x: Int) => { def f(y:Int):Int = if (y==0) 1 else 2 * f(y-1); f(x) }, a, b) scala> sumPowersOfTwo(2,3) res0: Int = 12

    Read the article

  • Sqllite doesn' write a column

    - by user1904675
    I do this: DatabaseHelper dbHelper = new DatabaseHelper(context); dbHelper.getWritableDatabase(); String sql = "insert into "+getTableName()+("+DatabaseHelper.PRODUCT_MARK+","+DatabaseHelper.PRODUCT_NAME+") VALUES ('"+input.getMark()+"','"+input.getName()+"')"; System.out.println(sql); getDatabase().execSQL(sql); dbHelper.close(); The system print 12-14 16:53:33.857: I/System.out(1350): insert into product (pMark,name) VALUES ('aaaaa ','zz') But when I read from db the property mark is not valorized... Where is my mistake?

    Read the article

  • How do I best write my own background-working and communicatible (sending progress updates and getti

    - by Ivan
    I have to develop a class which can run it's own hard-coded task in a background thread and communicate with container class sending him progress updates and taking messages from it. I believe I am going to extend BackgroundWorker class but it looks a bit weird to extend and I haven't managed to find a good example wit Google. Can you share a link to a good example of solving such a task? Please don't offer placing a BackgroundWorker visually on a form and reading the standard tutorial, it's not for my case. Maybe I'd better not extend but encapsulate a BackgroundWorker, but I hardly understand how to use it outide WinForms designer either :-(

    Read the article

  • Best way to write an image to a Django HttpResponse()

    - by k-g-f
    I need to serve images securely to validated users only (i.e. they can't be served as static files). I currently have the following Python view in my Django project, but it seems inefficient. Any ideas for a better way? def secureImage(request,imagePath): response = HttpResponse(mimetype="image/png") img = Image.open(imagePath) img.save(response,'png') return response (Image is imported from PIL.)

    Read the article

  • Write an expression in javascript

    - by Hero
    hi everybody... I need a javascript code that split a string like below: Input string: "a=aa| b=b||b | c=cc" Output: a=>aa b=>b||b c=>cc I'd written different codes like: split(/ \ | /) or Split(/ \| (?! \ |) /) but didn't work. please help me... I really need it fast.

    Read the article

  • how to write xsd for the following xml?

    - by Venkats
    <?xml version="1.0"?> <datatype xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="sampletype.xsd"> <table name="emp"> <columns> <column> <name>emp_id</name> <data_type>int(200) </data_type> </column> </columns> </table> </datatype> Here i generate the xsd for above xml, but it was not correct. can you help me generate the xsd for the xml? thanks in advance.

    Read the article

  • How do I write this GROUP BY in mysql UNION query

    - by user1652368
    Trying to group the results of two queries together. When I run this query: SELECT pr_id, pr_sbtcode, pr_sdesc, od_quantity, od_amount FROM ( SELECT `bgProducts`.`pr_id`, `bgProducts`.`pr_sbtcode`, `bgProducts`.`pr_sdesc`, SUM(`od_quantity`) AS `od_quantity`, SUM(`od_amount`) AS `od_amount`, MIN(UNIX_TIMESTAMP(`or_date`)) AS `or_date` FROM `bgOrderMain` JOIN `bgOrderData` JOIN `bgProducts` WHERE `bgOrderMain`.`or_id` = `bgOrderData`.`or_id` AND `od_pr` = `pr_id` AND UNIX_TIMESTAMP(`or_date`) >= '1262322000' AND UNIX_TIMESTAMP(`or_date`) <= '1346990399' AND (`pr_id` = '415' OR `pr_id` = '1088') GROUP BY `bgProducts`.`pr_id` UNION SELECT `bgProducts`.`pr_id`, `bgProducts`.`pr_sbtcode`, `bgProducts`.`pr_sdesc`,SUM(`od_quantity`) AS `od_quantity`, SUM(`od_amount`) AS `od_amount`, MIN(UNIX_TIMESTAMP(`or_date`)) AS `or_date` FROM `npOrderMain` JOIN `npOrderData` JOIN `bgProducts` WHERE `npOrderMain`.`or_id` = `npOrderData`.`or_id` AND `od_pr` = `pr_id` AND UNIX_TIMESTAMP(`or_date`) >= '1262322000' AND UNIX_TIMESTAMP(`or_date`) <= '1346990399' AND (`pr_id` = '415' OR `pr_id` = '1088') GROUP BY `bgProducts`.`pr_id` ) TEMPTABLE3; it produces this result +-------+------------+--------------------------+-------------+-----------+ | pr_id | pr_sbtcode | pr_sdesc | od_quantity | od_amount +-------+------------+--------------------------+-------------+-----------+ | 415 | NP13 | Product 13 | 5 | 125 | 1088 | NPAW | Product AW | 4 | 100 | 415 | NP13 | Product 13 | 5 | 125 | 1088 | NPAW | Product AW | 2 | 50 +-------+------------+--------------------------+-------------+-----------+</pre> What I want to get a result that combines those into 2 lines: +-------+------------+--------------------------+-------------+-----------+ | pr_id | pr_sbtcode | pr_sdesc | od_quantity | od_amount +-------+------------+--------------------------+-------------+-----------+ | 415 | NP13 | Product 13 | 10 | 250 | 1088 | NPAW | Product AW | 6 | 150 +-------+------------+--------------------------+-------------+-----------+</pre> So I added GROUP BY pr_id to the end of the query: SELECT pr_id, pr_sbtcode, pr_sdesc, od_quantity, od_amount FROM ( SELECT `bgProducts`.`pr_id`, `bgProducts`.`pr_sbtcode`, `bgProducts`.`pr_sdesc`, SUM(`od_quantity`) AS `od_quantity`, SUM(`od_amount`) AS `od_amount`, MIN(UNIX_TIMESTAMP(`or_date`)) AS `or_date` FROM `bgOrderMain` JOIN `bgOrderData` JOIN `bgProducts` WHERE `bgOrderMain`.`or_id` = `bgOrderData`.`or_id` AND `od_pr` = `pr_id` AND UNIX_TIMESTAMP(`or_date`) >= '1262322000' AND UNIX_TIMESTAMP(`or_date`) <= '1346990399' AND (`pr_id` = '415' OR `pr_id` = '1088') GROUP BY `bgProducts`.`pr_id` UNION SELECT `bgProducts`.`pr_id`, `bgProducts`.`pr_sbtcode`, `bgProducts`.`pr_sdesc`,SUM(`od_quantity`) AS `od_quantity`, SUM(`od_amount`) AS `od_amount`, MIN(UNIX_TIMESTAMP(`or_date`)) AS `or_date` FROM `npOrderMain` JOIN `npOrderData` JOIN `bgProducts` WHERE `npOrderMain`.`or_id` = `npOrderData`.`or_id` AND `od_pr` = `pr_id` AND UNIX_TIMESTAMP(`or_date`) >= '1262322000' AND UNIX_TIMESTAMP(`or_date`) <= '1346990399' AND (`pr_id` = '415' OR `pr_id` = '1088') GROUP BY `bgProducts`.`pr_id` ) TEMPTABLE3 GROUP BY pr_id; But that just gives me this: +-------+------------+--------------------------+-------------+-----------+ | pr_id | pr_sbtcode | pr_sdesc | od_quantity | od_amount +-------+------------+--------------------------+-------------+-----------+ | 415 | NP13 | Product 13 | 5 | 125 | 1088 | NPAW | Product AW | 4 | 100 +-------+------------+--------------------------+-------------+-----------+ What am I missing here??

    Read the article

  • How to write different implicit rules for different file names for GNU Make

    - by anupamsr
    Hi! I have a directory in which I keep adding different C++ source files, and generic Makefile to compile them. This is the content of the Makefile: .PHONY: all clean CXXFLAGS = -pipe -Wall -Wextra -Weffc++ -pedantic -ggdb SRCS = $(wildcard *.cxx) OBJS = $(patsubst %.cxx,%.out,$(SRCS)) all: $(OBJS) clean: rm -fv $(OBJS) %.out: %.cxx $(CXX) $(CXXFLAGS) $^ -o $@ NOTE: As is obvious from above, I am using *.out for executable file extensions (and not for object file). Also, there are some files which are compiled together: g++ file_main.cxx file.cxx -o file_main.out To compile such files, until now I have been adding explicit rules in the Makefile: file_main.out: file_main.cxx file.cxx file.out: file_main.out @echo "Skipping $@" But now my Makefile has a lot of explicit rules, and I would like to replace them with a simpler implicit rule. Any idea how to do it?

    Read the article

  • Using document.write in event handler?

    - by StackedCrooked
    I am experimenting with HTML and JavaScript. The following code should print something when entering a keystroke in a textbox: <html> <body> <input type="text" id="commandInput" name="command" size="50" /> <script type="text/javascript"> var commandInput = document.getElementById("commandInput"); commandInput.onkeydown = function (evt) { document.writeln("Test"); }; </script> </body> </html> For some reason the textbox disappears when entering a keystroke, leaving nothing but a white page. Any ideas why this is happening?

    Read the article

  • write a batch file to copy files from one folder to another folder

    - by user73628
    I am having a storage folder on network in which all users will store their active data on a server now that server is going to be replaced by new one due to place problem so I need to copy sub folders files from the old server storage folder to new server storage folder. I have below ex: from \Oldeserver\storage\data & files to \New server\storage\data & files.

    Read the article

  • how to write regular expression to validate a string using regex in C#

    - by Charu
    I need to validate a user input based on condition. i wrote a regular expression to do so, but it's failing not sure why. Can somebody point where i am making mistake? Regex AccuracyCodeHexRegex = new Regex(@"^[PTQA]((0|8)[01234567]){2}$"); This is what i am trying to validate(If the string is a subset of these strings then it is valid): Phh, Thh, Qhh, Ahh where 'h' is a hex digit in the set {00, 80, 01, 81, 02, 82, 03, 83, 04, 84, 05, 85, 06, 86, 07, 87} Ex: P00 is valid P20 is not valid

    Read the article

  • How can I write this shorter?

    - by nLL
    public static string GetUa(HttpRequest hr) { try { string visitorBrowser = hr.UserAgent.ToString(); string originalBrowser = hr.ServerVariables["X-OperaMini-Phone-UA"]; string anotherOriginalBrowser = hr.ServerVariables["X-Device-User-Agent"]; //novarra if (!String.IsNullOrEmpty(originalBrowser)) { return "OPERAMINI " + originalBrowser; } else { if (!String.IsNullOrEmpty(anotherOriginalBrowser)) { return "NOVARRA " + anotherOriginalBrowser; } else { return visitorBrowser; } } } catch { return "No UA Found"; } }

    Read the article

  • Hadoop write directory

    - by FaultyJuggler
    Simple question but reading through documentation and configuration I can't quite seem to figure it out. How do I A) know where hadoop is writing to on the local disk and B) change that For initial testing I setup HDFS on a 20gb linux VM - to it we've added a 500gb networked drive for moving towards prototyping the full system. So now how do I point HDFS at that drive, or do I simply move the home directory/install with some slight change in setup and restart the process?

    Read the article

  • Django: How to write the reverse function for the following

    - by ninja123
    The urlconf and view is as follows: url(r'^register/$', register, { 'backend': 'registration.backends.default.DefaultBackend' }, name='registration_register'), def register(request, backend, success_url=None, form_class=None, disallowed_url='registration_disallowed', template_name='registration/registration_form.html', extra_context=None): What i want to do is redirect users to the register page and specify a success_url. I tried reverse('registration.views.register', kwargs={'success_url':'/test/' }) but that doesn't seem to work. I've been trying for hours and can't get my mind around getting it right. Thanks

    Read the article

  • How to write back to database from Silverlight?

    - by Manoj
    Hi, I use LINQ to SQL to get data from a database and use a service contract to access it in Silverlight at the client side. I display the data in a DataGrid. Now how do I make sure that any changes in the datagrid is written back to the database? EDIT: This is the example code I implemented: http://www.silverlight.net/learn/tutorials/sqldatagrid-cs/ Here I wanted any change in the datagrid reflected back in the database. The SubmitChanges function works in the DataContext object which is: public partial class DataClasses1DataContext : System.Data.Linq.DataContext But this is not exposed in the contract and so not visible in the client side code.

    Read the article

  • Write a serverside c++/openGL App, that is accessible via JavaScript

    - by moka
    Hi, I am currently having an idea where I want to save an image from a c++/openGL application on demand from a browser. So basically I would like to run the application itself on the server and have a simple communication layer like this: JS - tell application to do calculations (and maybe pass a string or some simple data) application - tell JS when finished and maybe send a link, text or something as simple as that. I don't really have alot of experience with webservers and as such don't know if that is possible at all (it's just my naive thinking). And note: I am not talking about a webGL application, I just want to have simple communication between a c++ serverside application, and the user. Any ideas how to do that? Thanks alot!

    Read the article

  • Synchronize write to two collections

    - by glaz666
    I need to put some value to maps if it is not there yet. The key-value (if set) should always be in two collections (that is put should happen in two maps atomically). I have tried to implement this as follows: private final ConcurrentMap<String, Object> map1 = new ConcurrentHashMap<String, Object>(); private final ConcurrentMap<String, Object> map2 = new ConcurrentHashMap<String, Object>(); public Object putIfAbsent(String key) { Object retval = map1.get(key); if (retval == null) { synchronized (map1) { retval = map1.get(key); if (retval == null) { Object value = new Object(); //or get it somewhere synchronized (map2) { map1.put(key, value); map2.put(key, new Object()); } retval = value; } } } return retval; } public void doSomething(String key) { Object obj1 = map1.get(key); Object obj2 = map2.get(key); //do smth } Will that work fine in all cases? Thanks

    Read the article

  • How can I write this shorter? c#

    - by nLL
    public static string GetUa(HttpRequest hr) { try { string visitorBrowser = hr.UserAgent.ToString(); string originalBrowser = hr.ServerVariables["X-OperaMini-Phone-UA"]; string anotherOriginalBrowser = hr.ServerVariables["X-Device-User-Agent"]; //novarra if (!String.IsNullOrEmpty(originalBrowser)) { return "OPERAMINI " + originalBrowser; } else { if (!String.IsNullOrEmpty(anotherOriginalBrowser)) { return "NOVARRA " + anotherOriginalBrowser; } else { return visitorBrowser; } } } catch { return "No UA Found"; } }

    Read the article

< Previous Page | 52 53 54 55 56 57 58 59 60 61 62 63  | Next Page >