question_id
int64
4
6.31M
answer_id
int64
7
6.31M
title
stringlengths
9
150
question_body
stringlengths
0
28.8k
answer_body
stringlengths
60
27.2k
question_text
stringlengths
40
28.9k
combined_text
stringlengths
124
39.6k
tags
listlengths
1
6
question_score
int64
0
26.3k
answer_score
int64
0
28.8k
view_count
int64
15
14M
answer_count
int64
0
182
favorite_count
int64
0
32
question_creation_date
stringdate
2008-07-31 21:42:52
2011-06-10 18:12:18
answer_creation_date
stringdate
2008-07-31 22:17:57
2011-06-10 18:14:17
6,239,163
6,239,228
Android Checkable Menu Item
I have the following menu layout in my Android app: My problem is that the second menu item doesn't appear to be "checkable" when I run my app in the Android emulator. There should be a green tick about the item, right? To indicate that its checkable. Am I doing something wrong?
Layout looks right. But you must check and uncheck menu item in code. From the documentation: When a checkable item is selected, the system calls your respective item-selected callback method (such as onOptionsItemSelected() ). It is here that you must set the state of the checkbox, because a checkbox or radio button d...
Android Checkable Menu Item I have the following menu layout in my Android app: My problem is that the second menu item doesn't appear to be "checkable" when I run my app in the Android emulator. There should be a green tick about the item, right? To indicate that its checkable. Am I doing something wrong?
TITLE: Android Checkable Menu Item QUESTION: I have the following menu layout in my Android app: My problem is that the second menu item doesn't appear to be "checkable" when I run my app in the Android emulator. There should be a green tick about the item, right? To indicate that its checkable. Am I doing something w...
[ "android", "android-menu", "android-checkbox" ]
73
88
96,226
9
0
2011-06-04T20:21:15.720000
2011-06-04T20:33:19.973000
6,239,164
6,239,293
Exception when saving an object with related object EF 3.5
I get an error telling me that: "The EntityKey property can only be set when the current value of the property is null." when I try to save an object with related object. Here's my code: public partial class Cat{ public bool Save() { try { using (var context = new PhonebookEntities()) { if (this.ParentCat!= null) { if ...
Let me guess - the Cat.GetById(1) looks like: public static Cat GetById(int id) { using (var context = new PhonebookEntities()) { return context.Cats.Single(c => c.Id == id); } } You are using two different contexts - that is the source of the issue. The first context loads the Cat and fills it EntityKey but the second...
Exception when saving an object with related object EF 3.5 I get an error telling me that: "The EntityKey property can only be set when the current value of the property is null." when I try to save an object with related object. Here's my code: public partial class Cat{ public bool Save() { try { using (var context = ...
TITLE: Exception when saving an object with related object EF 3.5 QUESTION: I get an error telling me that: "The EntityKey property can only be set when the current value of the property is null." when I try to save an object with related object. Here's my code: public partial class Cat{ public bool Save() { try { usi...
[ "entity-framework" ]
0
1
400
1
0
2011-06-04T20:21:23.007000
2011-06-04T20:46:04.550000
6,239,169
6,239,241
Dynamic array of objects
I'm aware that I could use something called std::vector, but I'm afraid it's not possible because of the course restrictions. I need to make a dynamic extensible array of objects. The array should grow and grow when new objects need to be stored. Here is the class that the array belongs to: class TransactionList { priv...
You should add a maxTransactions variable, which would indicate the allocated length of your trans* array, and initialize both ammountTransactions and maxTransactions with 0. Your array would automatically double its size when we reach the limits of trans void TransactionList::add(Transaction & newTrans) { if(amountTra...
Dynamic array of objects I'm aware that I could use something called std::vector, but I'm afraid it's not possible because of the course restrictions. I need to make a dynamic extensible array of objects. The array should grow and grow when new objects need to be stored. Here is the class that the array belongs to: cla...
TITLE: Dynamic array of objects QUESTION: I'm aware that I could use something called std::vector, but I'm afraid it's not possible because of the course restrictions. I need to make a dynamic extensible array of objects. The array should grow and grow when new objects need to be stored. Here is the class that the arr...
[ "c++" ]
8
5
4,667
3
0
2011-06-04T20:22:34.950000
2011-06-04T20:35:37.873000
6,239,170
6,239,194
How can I get img src and text from distant elements using JQuery?
Could you please lend a hand as I am having some trouble getting the text of a heading and the source of an image element in order to create a list of the item clicked. But I will explain better with some code: Firstly I have a div element that goes like this: Item Title Some address More blahs and links for descriptio...
Try going back to the top and coming down again along the right DOM branch: var src = $(this).closest('.main_page_entry') // Back to the top.find('.main_item_desc.main_item_pic') // And down again..attr('src'); The closest method goes up the DOM tree through your ancestors: Get the first ancestor element that matches t...
How can I get img src and text from distant elements using JQuery? Could you please lend a hand as I am having some trouble getting the text of a heading and the source of an image element in order to create a list of the item clicked. But I will explain better with some code: Firstly I have a div element that goes lik...
TITLE: How can I get img src and text from distant elements using JQuery? QUESTION: Could you please lend a hand as I am having some trouble getting the text of a heading and the source of an image element in order to create a list of the item clicked. But I will explain better with some code: Firstly I have a div ele...
[ "javascript", "jquery", "get", "src", "attr" ]
0
2
1,735
4
0
2011-06-04T20:22:40.510000
2011-06-04T20:28:18.237000
6,239,176
6,239,236
store user input without mysql or php
I have a simple html application which displays words on a click of a next button. It fetches the words from a javascript object literal file. I want to mark some of the words as easy and some as difficult. How do I save this data from browser without using a mysql database? can I edit the javascript object file direct...
If you want to take user input and store it permanently on your site, you'll have to employ some sort of server-side scripting. This doesn't have to be PHP, but it's probably the simplest way to do it. You can't use client-side javascript to write to a remote file directly.
store user input without mysql or php I have a simple html application which displays words on a click of a next button. It fetches the words from a javascript object literal file. I want to mark some of the words as easy and some as difficult. How do I save this data from browser without using a mysql database? can I ...
TITLE: store user input without mysql or php QUESTION: I have a simple html application which displays words on a click of a next button. It fetches the words from a javascript object literal file. I want to mark some of the words as easy and some as difficult. How do I save this data from browser without using a mysq...
[ "javascript", "html" ]
3
3
534
3
0
2011-06-04T20:23:33.017000
2011-06-04T20:34:13.367000
6,239,179
6,239,237
Draw borders around some cells in a tablelayoutpanel
Don't ask why but I have the requirement to draw a border around certain cells in a TableLayoutPanel. For example, for simplicity, lets say I have a 1 row, 5 column TableLayoutPanel. Each cell has a button in it. I would like to draw a box around the first 3 cells and then another box around the last 2 cells. So two bo...
You could use CellPaint event and draw the border rectangle when needed: tableLayoutPanel1.CellPaint += tableLayoutPanel1_CellPaint; The handler: void tableLayoutPanel1_CellPaint(object sender, TableLayoutCellPaintEventArgs e) { if (e.Column == 1 && e.Row == 0) e.Graphics.DrawRectangle(new Pen(Color.Blue), e.CellBounds...
Draw borders around some cells in a tablelayoutpanel Don't ask why but I have the requirement to draw a border around certain cells in a TableLayoutPanel. For example, for simplicity, lets say I have a 1 row, 5 column TableLayoutPanel. Each cell has a button in it. I would like to draw a box around the first 3 cells an...
TITLE: Draw borders around some cells in a tablelayoutpanel QUESTION: Don't ask why but I have the requirement to draw a border around certain cells in a TableLayoutPanel. For example, for simplicity, lets say I have a 1 row, 5 column TableLayoutPanel. Each cell has a button in it. I would like to draw a box around th...
[ "c#", ".net", "winforms", "tablelayoutpanel" ]
19
31
30,586
3
0
2011-06-04T20:25:21.610000
2011-06-04T20:34:18.747000
6,239,180
6,239,219
Retrieving the coordinates of the MySQL point type
I'm storing lat/long pairs in MySQL as a point using something like: GeomFromText('POINT(32 -122)') Given the point, how do i retrieve the individual X/Y coordinates?
Let's say you store GeomFromText('POINT(32 -122)') as a column called MY_POINT in a table called MY_TABLE. Getting the X coordinate (will return 32 in this example): SELECT ST_X(MY_POINT) as longitude FROM MY_TABLE; Getting the Y coordinate (will return -122 in this example): SELECT ST_Y(MY_POINT) as latitude FROM MY_T...
Retrieving the coordinates of the MySQL point type I'm storing lat/long pairs in MySQL as a point using something like: GeomFromText('POINT(32 -122)') Given the point, how do i retrieve the individual X/Y coordinates?
TITLE: Retrieving the coordinates of the MySQL point type QUESTION: I'm storing lat/long pairs in MySQL as a point using something like: GeomFromText('POINT(32 -122)') Given the point, how do i retrieve the individual X/Y coordinates? ANSWER: Let's say you store GeomFromText('POINT(32 -122)') as a column called MY_PO...
[ "mysql" ]
36
77
27,834
2
0
2011-06-04T20:25:36.390000
2011-06-04T20:32:31.523000
6,239,185
6,239,195
What does the regex string "\\p{Cntrl}" match in Java?
I think it's matching all control characters (not sure what "all" might be) but I can't be certain, nor can I find it in any documentation other than some musings in a Perl forum. Does anyone know?
From the documentation of Pattern: \p{Cntrl} A control character: [\x00-\x1F\x7F] That is, it matches any character with hexadecimal value 00 through 1F or 7F. The Wikipedia article on control characters lists each character and what it's used for if you're interested.
What does the regex string "\\p{Cntrl}" match in Java? I think it's matching all control characters (not sure what "all" might be) but I can't be certain, nor can I find it in any documentation other than some musings in a Perl forum. Does anyone know?
TITLE: What does the regex string "\\p{Cntrl}" match in Java? QUESTION: I think it's matching all control characters (not sure what "all" might be) but I can't be certain, nor can I find it in any documentation other than some musings in a Perl forum. Does anyone know? ANSWER: From the documentation of Pattern: \p{Cn...
[ "java", "regex" ]
11
34
20,277
2
0
2011-06-04T20:26:21.120000
2011-06-04T20:28:37.840000
6,239,190
6,243,184
Is there a way to define a min-width on a jquery mobile website?
I would like to define a min-width on a page of a jquery mobile website but it seems not working. Am I wrong? Something like if the page width if less than 200px then place an horizontal scrollbar. Thanks.
Hmm not sure about other smart phones but the iPhone (older models) are 320 x 480. I really don't think there is a 200px width on a smartphone, but I could be way off on this as well. Supported Browsers: http://jquerymobile.com/gbs/ Also you could run media queries or add a breakpoint: http://jquerymobile.com/demos/1.0...
Is there a way to define a min-width on a jquery mobile website? I would like to define a min-width on a page of a jquery mobile website but it seems not working. Am I wrong? Something like if the page width if less than 200px then place an horizontal scrollbar. Thanks.
TITLE: Is there a way to define a min-width on a jquery mobile website? QUESTION: I would like to define a min-width on a page of a jquery mobile website but it seems not working. Am I wrong? Something like if the page width if less than 200px then place an horizontal scrollbar. Thanks. ANSWER: Hmm not sure about oth...
[ "jquery", "jquery-mobile" ]
0
0
1,629
2
0
2011-06-04T20:27:34.343000
2011-06-05T13:23:46.403000
6,239,214
6,239,259
Control a process using webforms
I am trying here to find a solution to control a process I launch via webforms. I know it is quite easy to start-stop it using System.Diagnostics.Process class. What I am trying to achieve is to send data to the process (a terraria server). Basically the server itself when it is launched correctly you can write inside ...
Are you perhaps looking for the BackgroundWorker class that was introduced in.Net 3.5? To execute a time-consuming operation in the background, you create a BackgroundWorker, and then listen for events that reportt the progress of your operation and signal when your operation is finished. It executes on a separate thre...
Control a process using webforms I am trying here to find a solution to control a process I launch via webforms. I know it is quite easy to start-stop it using System.Diagnostics.Process class. What I am trying to achieve is to send data to the process (a terraria server). Basically the server itself when it is launche...
TITLE: Control a process using webforms QUESTION: I am trying here to find a solution to control a process I launch via webforms. I know it is quite easy to start-stop it using System.Diagnostics.Process class. What I am trying to achieve is to send data to the process (a terraria server). Basically the server itself ...
[ "c#", ".net-4.0", "process", "webforms" ]
0
0
134
3
0
2011-06-04T20:30:58.423000
2011-06-04T20:39:06.313000
6,239,226
6,239,240
C strange anomaly, when writing to file (works normally when writing to stdout)
I'm very new to C so please bear with me. I am struggling with this for really long time and I had a hard time to narrow down the cause of error. I noticed that when forking process and writing to a file (only the original process writes to the file a strange thing happens, the output is nearly multiplied by the number...
stdout is usually unbuffered or line buffered; other files are typically block buffered. You need to fflush() them before fork(), or every child will flush its own copy of the buffer, leading to this multiplication.
C strange anomaly, when writing to file (works normally when writing to stdout) I'm very new to C so please bear with me. I am struggling with this for really long time and I had a hard time to narrow down the cause of error. I noticed that when forking process and writing to a file (only the original process writes to...
TITLE: C strange anomaly, when writing to file (works normally when writing to stdout) QUESTION: I'm very new to C so please bear with me. I am struggling with this for really long time and I had a hard time to narrow down the cause of error. I noticed that when forking process and writing to a file (only the original...
[ "c", "file", "stdout" ]
5
8
118
1
0
2011-06-04T20:33:08.367000
2011-06-04T20:35:33.337000
6,239,243
6,239,254
More columns with less data or less columns with more data?
I want to know what is better. save all data (for example skype,icq,facebook,stackoverflow,etc,etc,etc) profiles in one column save data in separated columns (separated column for skype, icq, facebook, stackoverflow, etc,etc) What is better and easy for mysql server?
Saving them all in one column would violate first normal form and make querying and aggregating the data very difficult. Use one column to store each piece of information. If you are storing profile data for each service, you might even be better of with a separate table per service, with a foreign key to the user id.
More columns with less data or less columns with more data? I want to know what is better. save all data (for example skype,icq,facebook,stackoverflow,etc,etc,etc) profiles in one column save data in separated columns (separated column for skype, icq, facebook, stackoverflow, etc,etc) What is better and easy for mysql ...
TITLE: More columns with less data or less columns with more data? QUESTION: I want to know what is better. save all data (for example skype,icq,facebook,stackoverflow,etc,etc,etc) profiles in one column save data in separated columns (separated column for skype, icq, facebook, stackoverflow, etc,etc) What is better a...
[ "mysql", "sql" ]
1
4
328
3
0
2011-06-04T20:36:22.073000
2011-06-04T20:38:25.313000
6,239,250
6,239,353
Displaying comments
Hey guys sorry if this is an amateur question but I'm having a little trouble with this. How do I display comments towards a specific page? (page.php?id=48) Because right now, every time i post a comment, it displays on all pages instead of the one i wanted it to post on Heres the code: $userfinal=$_SESSION['username']...
take a look at my sample code. Consider a table comments with the basic structure. CREATE TABLE `comments` ( `id` int(11) NOT NULL AUTO_INCREMENT, `comment` text NOT NULL, `article_id` int(11) NOT NULL, PRIMARY KEY (`id`) ); comment column will hold the text of your comment article_id holds the foreign key of the artic...
Displaying comments Hey guys sorry if this is an amateur question but I'm having a little trouble with this. How do I display comments towards a specific page? (page.php?id=48) Because right now, every time i post a comment, it displays on all pages instead of the one i wanted it to post on Heres the code: $userfinal=$...
TITLE: Displaying comments QUESTION: Hey guys sorry if this is an amateur question but I'm having a little trouble with this. How do I display comments towards a specific page? (page.php?id=48) Because right now, every time i post a comment, it displays on all pages instead of the one i wanted it to post on Heres the ...
[ "php", "mysql", "comments", "messaging" ]
1
3
241
1
0
2011-06-04T20:37:28.033000
2011-06-04T20:56:05.323000
6,239,255
6,239,279
How to configure sub domains to asp.net mvc 3 areas
I am building an asp.net mvc 3 web application. In my application I am using areas to separate my blog from my core website. The blog is sitting in its own sub domain: blog.mysite.com I'd like to map my area to the sub domain, how can this be achieved? Thank you
Please refer to this post as it should point you in the right direction. Can Areas in an ASP.NET MVC 2 application map to a subdomain? or http://forums.asp.net/t/1677286.aspx/1 Good luck
How to configure sub domains to asp.net mvc 3 areas I am building an asp.net mvc 3 web application. In my application I am using areas to separate my blog from my core website. The blog is sitting in its own sub domain: blog.mysite.com I'd like to map my area to the sub domain, how can this be achieved? Thank you
TITLE: How to configure sub domains to asp.net mvc 3 areas QUESTION: I am building an asp.net mvc 3 web application. In my application I am using areas to separate my blog from my core website. The blog is sitting in its own sub domain: blog.mysite.com I'd like to map my area to the sub domain, how can this be achieve...
[ "asp.net-mvc-3", "subdomain", "asp.net-mvc-areas" ]
3
2
2,851
1
0
2011-06-04T20:38:26.223000
2011-06-04T20:43:36.437000
6,239,256
6,239,337
OpenIDSelector problem in asp.net
I am trying to use OpenID in my website using asp.net_c#. I am working on asp.net forms website with asp.net v4. The issue i am having is with openidselector control from my toolbox generated from dotnetopenauth.dll. It does not work and not even displays. Any help? code:
I use the following one and it is really great. But you need to figure out most of the stuff to work with your asp.net logic; http://code.google.com/p/openid-selector/ EDIT Also this could be helpful; http://bhaidar.net/post/2011/04/04/OpenID-Single-Sign-On-ASPNET-Web-Forms.aspx
OpenIDSelector problem in asp.net I am trying to use OpenID in my website using asp.net_c#. I am working on asp.net forms website with asp.net v4. The issue i am having is with openidselector control from my toolbox generated from dotnetopenauth.dll. It does not work and not even displays. Any help? code:
TITLE: OpenIDSelector problem in asp.net QUESTION: I am trying to use OpenID in my website using asp.net_c#. I am working on asp.net forms website with asp.net v4. The issue i am having is with openidselector control from my toolbox generated from dotnetopenauth.dll. It does not work and not even displays. Any help? c...
[ "c#", "asp.net", "visual-studio-2010", "dotnetopenauth" ]
1
3
249
1
0
2011-06-04T20:38:35.067000
2011-06-04T20:53:25.423000
6,239,291
6,239,313
Logging in via a script to a remote server and execute a set of commands
How can I login to a remote server and execute a set of commands then when done logout and continue my script? Thanks.
ssh can be used to execute a command, rather than start a remote interactive login shell. For example: ssh user@host ls Will log into host and execute the ls command. You can use this inside a bash script as normal: #!/bin/bash # do local commands ssh user@host "ls; grep something file.txt; copy a b" # do more local...
Logging in via a script to a remote server and execute a set of commands How can I login to a remote server and execute a set of commands then when done logout and continue my script? Thanks.
TITLE: Logging in via a script to a remote server and execute a set of commands QUESTION: How can I login to a remote server and execute a set of commands then when done logout and continue my script? Thanks. ANSWER: ssh can be used to execute a command, rather than start a remote interactive login shell. For example...
[ "bash", "command-line", "ssh" ]
9
12
22,839
3
0
2011-06-04T20:45:24.660000
2011-06-04T20:49:46.717000
6,239,294
6,239,320
PHP MySQL double inner join
I have three tables: posts id post_id user_id comments id post_id comment_id user_id deleted replies id post_id reply_id user_id deleted I am trying to get all comments and replies from each post.post_id with post.user_id=x. I tried: SELECT * FROM posts AS p INNER JOIN comments as c ON c.comment_id=p.post_id INNER JOIN...
You're missing a key relationship in your model. You need to have a column in replies and comments for post_id, and then join the tables on post_id. Once you've made this change, then your query would look like this: SELECT c.*, r.* FROM posts p INNER JOIN comments c ON p.id=c.post_id INNER JOIN replies r ON p.id=r.pos...
PHP MySQL double inner join I have three tables: posts id post_id user_id comments id post_id comment_id user_id deleted replies id post_id reply_id user_id deleted I am trying to get all comments and replies from each post.post_id with post.user_id=x. I tried: SELECT * FROM posts AS p INNER JOIN comments as c ON c.com...
TITLE: PHP MySQL double inner join QUESTION: I have three tables: posts id post_id user_id comments id post_id comment_id user_id deleted replies id post_id reply_id user_id deleted I am trying to get all comments and replies from each post.post_id with post.user_id=x. I tried: SELECT * FROM posts AS p INNER JOIN comm...
[ "php", "mysql", "join" ]
6
8
21,389
3
0
2011-06-04T20:46:10.587000
2011-06-04T20:51:11.867000
6,239,302
6,239,322
What to do with XML information after first startup of Android App
So im looking for some guidance in terms of storing data within my android application. At the moment, i have an XML file that stores a bunch of Restaurant elements. i read this file when the application starts and store all the restaurants in an ArrayList. Now i am trying to add a favorite Restaurant functionality. Th...
XML-files are nice if you want to include data that doesn't change. If you want to work with your data and change it, a Database is the common way. But do it with an SQLiteOpenHelper, where you can also define some standard-values in the onCreate -method. The first time your App starts (after the user installed it) and...
What to do with XML information after first startup of Android App So im looking for some guidance in terms of storing data within my android application. At the moment, i have an XML file that stores a bunch of Restaurant elements. i read this file when the application starts and store all the restaurants in an ArrayL...
TITLE: What to do with XML information after first startup of Android App QUESTION: So im looking for some guidance in terms of storing data within my android application. At the moment, i have an XML file that stores a bunch of Restaurant elements. i read this file when the application starts and store all the restau...
[ "java", "android", "xml" ]
0
0
120
2
0
2011-06-04T20:48:05.780000
2011-06-04T20:51:26.400000
6,239,315
6,242,017
Opening links that are in an iFrame(no control over the child site) in the parent window
I am making an app for a website, and I need to include a certain part of the website, which I have done with an iframe. I have turned that into my own site, and everything works fine with the web view and such. The problem is the links are opened inside the iframe, whereas I want the page to fill the web view. I canno...
I think jQuery can help you. You need to find all links inside your frame and add required attribute to each of them. $('#yourIframe').contents().find('a').each(function () { $(this).attr('target', '_blank'); }); P.S. Don't forget to change your ifarame id (or change to class, if you like).
Opening links that are in an iFrame(no control over the child site) in the parent window I am making an app for a website, and I need to include a certain part of the website, which I have done with an iframe. I have turned that into my own site, and everything works fine with the web view and such. The problem is the ...
TITLE: Opening links that are in an iFrame(no control over the child site) in the parent window QUESTION: I am making an app for a website, and I need to include a certain part of the website, which I have done with an iframe. I have turned that into my own site, and everything works fine with the web view and such. T...
[ "html", "objective-c", "ios", "iframe", "uiwebview" ]
1
0
1,561
1
0
2011-06-04T20:50:10.100000
2011-06-05T09:19:56.277000
6,239,325
6,239,351
Java NullPointerException
I get a java.lang.NullPointerException in my Class Article in line 5. In one class I create the object Article article = new Article(), then I call article.addPrice(quantity, price); with quantity being an Integer with the value ' 1 ' and price being a Float with the value ' 1.32 '. 1: public class Article { 2: private...
you need to initialize the prices list. prices = new ArrayList ();
Java NullPointerException I get a java.lang.NullPointerException in my Class Article in line 5. In one class I create the object Article article = new Article(), then I call article.addPrice(quantity, price); with quantity being an Integer with the value ' 1 ' and price being a Float with the value ' 1.32 '. 1: public ...
TITLE: Java NullPointerException QUESTION: I get a java.lang.NullPointerException in my Class Article in line 5. In one class I create the object Article article = new Article(), then I call article.addPrice(quantity, price); with quantity being an Integer with the value ' 1 ' and price being a Float with the value ' ...
[ "java", "nullpointerexception" ]
0
7
208
6
0
2011-06-04T20:51:32.457000
2011-06-04T20:55:15.607000
6,240,212
6,241,349
With respect to client side security, does CORS do anything other than subvert same-origin-policy?
(and if not, does it actually improve client side security?) I'm thinking of the case where a script from server X uses XHR to obtain and run untrusted code from server Y (which supports CORS). (obviously evaluating untrusted code is bad™)
I do not use CORS to improve security at all. I use CORS to access a known webservice on a different domain which I would not be allowed to access without CORS. Nothing to do with improving security in my opinion, but to allow data from one domain to be entrusted to another.
With respect to client side security, does CORS do anything other than subvert same-origin-policy? (and if not, does it actually improve client side security?) I'm thinking of the case where a script from server X uses XHR to obtain and run untrusted code from server Y (which supports CORS). (obviously evaluating untru...
TITLE: With respect to client side security, does CORS do anything other than subvert same-origin-policy? QUESTION: (and if not, does it actually improve client side security?) I'm thinking of the case where a script from server X uses XHR to obtain and run untrusted code from server Y (which supports CORS). (obviousl...
[ "javascript", "ajax", "xmlhttprequest", "same-origin-policy", "cors" ]
6
6
2,518
3
0
2011-06-05T00:21:01.563000
2011-06-05T06:21:54.560000
6,240,217
6,243,673
printing values out in ARM assembly?
I'm new to ARM and am wondering how you would print out values inside registers?. I tried this but it is just giving me a blank screen on QEMU..global _start _start: bl hardware_init mov r0,#20.print "something happend" What I'm trying to do is figure out what labels and what jumps occur in a program by printing.
I have not used.print before, know nothing about it. I normally shoot characters out the serial port. You can cheat on qemu and not initialize the serial port because it is virtual and just write bytes to the transmit register, likewise you dont have to wait for the transmit status to show the character has gone you ca...
printing values out in ARM assembly? I'm new to ARM and am wondering how you would print out values inside registers?. I tried this but it is just giving me a blank screen on QEMU..global _start _start: bl hardware_init mov r0,#20.print "something happend" What I'm trying to do is figure out what labels and what jumps...
TITLE: printing values out in ARM assembly? QUESTION: I'm new to ARM and am wondering how you would print out values inside registers?. I tried this but it is just giving me a blank screen on QEMU..global _start _start: bl hardware_init mov r0,#20.print "something happend" What I'm trying to do is figure out what lab...
[ "assembly", "printing", "arm" ]
1
1
2,439
1
0
2011-06-05T00:21:40.007000
2011-06-05T15:00:24.413000
6,240,224
6,240,257
Java JAX-RS Web Service Question
What is the difference between a class annotated with @Path and a class annotated with @WebService (What is Service endpoint implementation)? After reading the documentation, @WebService is used with SOAP where @Path is for REST. Any REST simplest example in java with a web client consumes resource from a service in a ...
@Path is for JAX-RS services (i.e., a REST interface) whereas @WebService is for JAX- W S services (i.e., a SOAP interface). In principle, it's entirely possible to have both on the same class – there's formally no interaction between the two – though I find it simpler in practice to have next to nothing shared between...
Java JAX-RS Web Service Question What is the difference between a class annotated with @Path and a class annotated with @WebService (What is Service endpoint implementation)? After reading the documentation, @WebService is used with SOAP where @Path is for REST. Any REST simplest example in java with a web client consu...
TITLE: Java JAX-RS Web Service Question QUESTION: What is the difference between a class annotated with @Path and a class annotated with @WebService (What is Service endpoint implementation)? After reading the documentation, @WebService is used with SOAP where @Path is for REST. Any REST simplest example in java with ...
[ "resources", "service", "path", "annotations" ]
0
1
219
1
0
2011-06-05T00:23:32.127000
2011-06-05T00:34:39.917000
6,240,226
6,240,237
Jquery Delay Event
$('#cart >.heading a').bind('mouseenter', function() { $('#cart').addClass('active'); $.ajax({ url: 'index.php?route=checkout/cart/update', dataType: 'json', success: function(json) { if (json['output']) { $('#cart.content').html(json['output']); } } }); $('#cart').bind('mouseleave', function() { $(this).removeClass(...
You could just use setTimeout() $('#cart').bind('mouseleave', function() { var $that = $(this); setTimeout(function(){$that.removeClass('active');}, 500); //500 millisec delay });
Jquery Delay Event $('#cart >.heading a').bind('mouseenter', function() { $('#cart').addClass('active'); $.ajax({ url: 'index.php?route=checkout/cart/update', dataType: 'json', success: function(json) { if (json['output']) { $('#cart.content').html(json['output']); } } }); $('#cart').bind('mouseleave', function() { $...
TITLE: Jquery Delay Event QUESTION: $('#cart >.heading a').bind('mouseenter', function() { $('#cart').addClass('active'); $.ajax({ url: 'index.php?route=checkout/cart/update', dataType: 'json', success: function(json) { if (json['output']) { $('#cart.content').html(json['output']); } } }); $('#cart').bind('mouseleav...
[ "jquery", "delay" ]
1
5
3,753
2
0
2011-06-05T00:23:56.177000
2011-06-05T00:26:59.990000
6,240,235
6,240,251
How can you maintain a value (int or string) for use after closing an application
I have some ints and strings that change as the app is played. I would like to keep a revolving score that can be added to after the application closes and reopens.
When the program closes ( or at some checkpoint ) you can save the data to storage medium, e.g. file(s), registry key(s), database record(s). Then when the program loads ( or possibly a dialog invoked by he user ) load said record(s).
How can you maintain a value (int or string) for use after closing an application I have some ints and strings that change as the app is played. I would like to keep a revolving score that can be added to after the application closes and reopens.
TITLE: How can you maintain a value (int or string) for use after closing an application QUESTION: I have some ints and strings that change as the app is played. I would like to keep a revolving score that can be added to after the application closes and reopens. ANSWER: When the program closes ( or at some checkpoin...
[ "ios", "string", "int" ]
0
1
163
3
0
2011-06-05T00:26:29.380000
2011-06-05T00:30:50.853000
6,240,236
6,240,314
Help reduce site load-time. How can I cut down this resource?
My index resource takes up half my sites load time. Google got it down to just about 30-50 ms, how would I go about achieving this? Also, how can I parallelize the downloading of my images. They all wait for the previous one to load before starting to load, any way to fix this? Thanks! ~ Jackson
Are you geographically located in relative proximity to the server this page is hosted on? If not, then the long wait time you're looking at (before the darker shade of blue, where data is actually being transferred) is bound to be longer. Since it's the first document served to you, a connection between the server and...
Help reduce site load-time. How can I cut down this resource? My index resource takes up half my sites load time. Google got it down to just about 30-50 ms, how would I go about achieving this? Also, how can I parallelize the downloading of my images. They all wait for the previous one to load before starting to load, ...
TITLE: Help reduce site load-time. How can I cut down this resource? QUESTION: My index resource takes up half my sites load time. Google got it down to just about 30-50 ms, how would I go about achieving this? Also, how can I parallelize the downloading of my images. They all wait for the previous one to load before ...
[ "optimization", "resources", "load", "indexing" ]
1
1
149
2
0
2011-06-05T00:26:43.077000
2011-06-05T00:50:12.697000
6,240,246
6,240,488
how do i process this file using awk or perl?
I want to process some log file whose format is like: I want to get a summary that contains the following information for each item I want to know the range of the field and the average of
I agree with Seth, and prefer his answer. Here is a manual solution in Awk, for learning purposes: #!/usr/bin/awk -f #invoke with: < infile stats.awk { i = $1; v = $2; count[i]++; sum[i] += v; if (v > max[i] || count[i] == 1) { max[i] = v }; if (v < min[i] || count[i] == 1) { min[i] = v }; } END { for (i in count) { p...
how do i process this file using awk or perl? I want to process some log file whose format is like: I want to get a summary that contains the following information for each item I want to know the range of the field and the average of
TITLE: how do i process this file using awk or perl? QUESTION: I want to process some log file whose format is like: I want to get a summary that contains the following information for each item I want to know the range of the field and the average of ANSWER: I agree with Seth, and prefer his answer. Here is a manual...
[ "perl", "awk" ]
1
3
200
2
0
2011-06-05T00:29:59.987000
2011-06-05T01:37:20.333000
6,240,256
6,240,278
What is sourceannotations.h?
Visual studio keeps including sourceannotations.h to my C++ projects. This file seems to be.NET, and I am not using CLR (only native C++). I wanted to take preprocessed.cpp file to check it in external tool (like clang or cppcheck) but they don't support MS syntax.
According to here, source annotations are used to reduce code defects and it does not seem specific to.Net.
What is sourceannotations.h? Visual studio keeps including sourceannotations.h to my C++ projects. This file seems to be.NET, and I am not using CLR (only native C++). I wanted to take preprocessed.cpp file to check it in external tool (like clang or cppcheck) but they don't support MS syntax.
TITLE: What is sourceannotations.h? QUESTION: Visual studio keeps including sourceannotations.h to my C++ projects. This file seems to be.NET, and I am not using CLR (only native C++). I wanted to take preprocessed.cpp file to check it in external tool (like clang or cppcheck) but they don't support MS syntax. ANSWER...
[ "c++", "visual-c++" ]
1
1
850
1
0
2011-06-05T00:34:39.647000
2011-06-05T00:39:46.073000
6,240,266
6,240,297
File Shredding Concept question
I have a file shredder on my computer, and I wanted to know if it's possible to make one in JAVA just for learning sake. But, I'm not sure how exactly it works, so this is what I think it does, please correct me where I'm wrong. So basically it keeps encrypting the bytes of the file, and then simply deletes it. But tha...
Overwriting will solve the problem but it depends on the filesystem/platform (see the comment below). Here's a related question with.NET (not so much different than Java) Shredding files in.NET
File Shredding Concept question I have a file shredder on my computer, and I wanted to know if it's possible to make one in JAVA just for learning sake. But, I'm not sure how exactly it works, so this is what I think it does, please correct me where I'm wrong. So basically it keeps encrypting the bytes of the file, and...
TITLE: File Shredding Concept question QUESTION: I have a file shredder on my computer, and I wanted to know if it's possible to make one in JAVA just for learning sake. But, I'm not sure how exactly it works, so this is what I think it does, please correct me where I'm wrong. So basically it keeps encrypting the byte...
[ "java", "file", "shred" ]
2
1
2,236
4
0
2011-06-05T00:37:34.283000
2011-06-05T00:45:50.187000
6,240,267
6,240,284
Drawing on WPF with System.Drawing.Graphics?
I'm making a game in WPF in which I need to be able to use the drawing functions in System.Drawing.Graphics. I looked into the OnRender function, but that only has a DrawingContext object, which is not what I need. So, is there some control in WPF that I can place on my WPF Window that has an OnPaint (or something simi...
You could use the WindowsFormsHost to host a Win Forms Control with OnPaint overrided
Drawing on WPF with System.Drawing.Graphics? I'm making a game in WPF in which I need to be able to use the drawing functions in System.Drawing.Graphics. I looked into the OnRender function, but that only has a DrawingContext object, which is not what I need. So, is there some control in WPF that I can place on my WPF ...
TITLE: Drawing on WPF with System.Drawing.Graphics? QUESTION: I'm making a game in WPF in which I need to be able to use the drawing functions in System.Drawing.Graphics. I looked into the OnRender function, but that only has a DrawingContext object, which is not what I need. So, is there some control in WPF that I ca...
[ "wpf", "drawing" ]
2
4
1,128
1
0
2011-06-05T00:37:41.080000
2011-06-05T00:41:36.030000
6,240,271
6,247,404
Selectively compiling in code outside of a macro
Is it possible to selectively compile in certain sections of code with templates, or is this limited to the preprocessor? For example, if I wanted to remove a section of code with the preprocessor, I know I can do: #if 0 static const char[] hello_world = "hello, world"; #endif Is there anyway to do the same with templa...
Given your edit, it seems like you're making this a lot harder than it has to be. Where you define your macro, provide an #ifdef block there, and chose how you define it. #ifdef NDEBUG #define unittest(NAME) static void dummy_func_##NAME() #else #define unittest(NAME) \ struct unittest_ ## NAME: \ public unittest::unit...
Selectively compiling in code outside of a macro Is it possible to selectively compile in certain sections of code with templates, or is this limited to the preprocessor? For example, if I wanted to remove a section of code with the preprocessor, I know I can do: #if 0 static const char[] hello_world = "hello, world"; ...
TITLE: Selectively compiling in code outside of a macro QUESTION: Is it possible to selectively compile in certain sections of code with templates, or is this limited to the preprocessor? For example, if I wanted to remove a section of code with the preprocessor, I know I can do: #if 0 static const char[] hello_world ...
[ "c++", "unit-testing", "debugging", "templates", "metaprogramming" ]
2
0
579
4
0
2011-06-05T00:38:37.400000
2011-06-06T02:52:27.487000
6,240,280
6,240,357
NotifyIcon showing message from program
Just wondering if there is a way to display a message from the notifyicon when a certain event in the program is reached. Almost like a balloon popup. I cant seem to find anything online... This would be used to alert the user to a certain event in the program. Thanks in advance!
If you use notify icon: this.WindowState = FormWindowState.Minimized; notifyIcon1.Icon = new Icon(SystemIcons.Application, 40, 40); notifyIcon1.Visible = true; Much like you can use the BallonTip member of the it: notifyIcon1.BalloonTipText = "The quick brown fox. Jump!"; notifyIcon1.BalloonTipIcon = ToolTipIcon.Info; ...
NotifyIcon showing message from program Just wondering if there is a way to display a message from the notifyicon when a certain event in the program is reached. Almost like a balloon popup. I cant seem to find anything online... This would be used to alert the user to a certain event in the program. Thanks in advance!
TITLE: NotifyIcon showing message from program QUESTION: Just wondering if there is a way to display a message from the notifyicon when a certain event in the program is reached. Almost like a balloon popup. I cant seem to find anything online... This would be used to alert the user to a certain event in the program. ...
[ "c#", "notifyicon" ]
2
4
11,615
2
0
2011-06-05T00:40:06.477000
2011-06-05T01:00:08.427000
6,240,283
6,240,362
How can I #include a file with encrypted string?
I am writing a C app on Windows with MinGW/gcc. I need to use the #include directive to include a file that contains an encrypted string. The string will be decrypted at runtime. I want to do this so the string will not be visible if looking at the executable with a hex editor. I tried this, but it doesn't work. You ge...
If you installed and configured MSYS when you installed MinGW, you should have access to a command called xxd, which takes a hex dump of a file. By using the -i command line flag, you can get it to output a C-friendly file which you can easily import. An example call would be: xxd -i in_file output.h The contents of ou...
How can I #include a file with encrypted string? I am writing a C app on Windows with MinGW/gcc. I need to use the #include directive to include a file that contains an encrypted string. The string will be decrypted at runtime. I want to do this so the string will not be visible if looking at the executable with a hex ...
TITLE: How can I #include a file with encrypted string? QUESTION: I am writing a C app on Windows with MinGW/gcc. I need to use the #include directive to include a file that contains an encrypted string. The string will be decrypted at runtime. I want to do this so the string will not be visible if looking at the exec...
[ "c", "windows", "visual-studio", "encryption", "mingw" ]
0
4
276
3
0
2011-06-05T00:41:27.860000
2011-06-05T01:01:06.177000
6,240,287
6,240,433
Design Question for Ruby on Rails Project
I'm beginning to work on a new Ruby on Rails application that is a CRUD interface for certain attributes contained in a config file. The process will look something like: CRUD RoR App > Database > Export to config file. My question is what is the optimal way to design this (the back-end part that exports from the DB to...
Yes, you can simply treat ConfigFile as a model class that doesn't use ActiveRecord. It can go with your other models (doesn't have to go in /lib). class ConfigFile #note no inheriting from AR::Base def import... end def export... end end This class can be the interface to the file, used by your Rails app. I'm not su...
Design Question for Ruby on Rails Project I'm beginning to work on a new Ruby on Rails application that is a CRUD interface for certain attributes contained in a config file. The process will look something like: CRUD RoR App > Database > Export to config file. My question is what is the optimal way to design this (the...
TITLE: Design Question for Ruby on Rails Project QUESTION: I'm beginning to work on a new Ruby on Rails application that is a CRUD interface for certain attributes contained in a config file. The process will look something like: CRUD RoR App > Database > Export to config file. My question is what is the optimal way t...
[ "ruby-on-rails", "ruby", "class", "web-applications" ]
2
1
101
2
0
2011-06-05T00:42:31.347000
2011-06-05T01:19:38.270000
6,240,300
6,256,521
Aptana 3.0 Rails debugger error
Seeing this error while trying to launch debugger in Aptana Studio 3, build: 3.0.1.201104291443 Fast Debugger (ruby-debug-ide 0.4.16, ruby-debug-base 0.10.4) listens on 127.0.0.1:32650 Fatal exception in DebugThread loop: The requested service provider could not be loaded or initialized. - socket(2) Backtrace: C:/Rails...
This is a known bug on Windows when using a shell that has spaces in the path. See https://aptana.lighthouseapp.com/projects/35272/tickets/2548-using-our-installed-portablegit-doesnt-set-up-env-properly The bug has been fixed in development and will be in the upcoming 3.0.2 release. There's a Tender support discussion ...
Aptana 3.0 Rails debugger error Seeing this error while trying to launch debugger in Aptana Studio 3, build: 3.0.1.201104291443 Fast Debugger (ruby-debug-ide 0.4.16, ruby-debug-base 0.10.4) listens on 127.0.0.1:32650 Fatal exception in DebugThread loop: The requested service provider could not be loaded or initialized....
TITLE: Aptana 3.0 Rails debugger error QUESTION: Seeing this error while trying to launch debugger in Aptana Studio 3, build: 3.0.1.201104291443 Fast Debugger (ruby-debug-ide 0.4.16, ruby-debug-base 0.10.4) listens on 127.0.0.1:32650 Fatal exception in DebugThread loop: The requested service provider could not be load...
[ "ruby-on-rails", "debugging", "aptana" ]
1
0
848
1
0
2011-06-05T00:46:19.300000
2011-06-06T18:41:08.530000
6,240,310
6,240,351
http server authentication
I have a servlet application deployed on a tomcat 7.0 server (call it Server A). The app will take user's credential and pass it to another server (Server B) to retrieve data. Problem: user Alice from machine 1 logged into Server A. Server A uses Alice's credential to access Server B. getPasswordAuthentication () is us...
you need to explicitly clear the cache prior to access server b's resources by using AuthCacheValue.setAuthCache(new AuthCacheImpl()); This is because the credentials are cached by default and there is no configuration to specify caching behavior. import sun.net.www.protocol.http.AuthCacheValue; import sun.net.www.prot...
http server authentication I have a servlet application deployed on a tomcat 7.0 server (call it Server A). The app will take user's credential and pass it to another server (Server B) to retrieve data. Problem: user Alice from machine 1 logged into Server A. Server A uses Alice's credential to access Server B. getPass...
TITLE: http server authentication QUESTION: I have a servlet application deployed on a tomcat 7.0 server (call it Server A). The app will take user's credential and pass it to another server (Server B) to retrieve data. Problem: user Alice from machine 1 logged into Server A. Server A uses Alice's credential to access...
[ "authentication", "tomcat", "tomcat7" ]
1
0
383
2
0
2011-06-05T00:49:10.403000
2011-06-05T00:59:24.180000
6,240,311
6,253,652
OneToMany/ManyToOne SchemaException
I try to build a manyToOne relation for my Symfony2 application with Doctrine2. I get this error and I don't know why: app/console doctrine:schema:create PHP Deprecated: Comments starting with '#' are deprecated in /etc/php5/cli/conf.d/mcrypt.ini on line 1 in Unknown on line 0 ATTENTION: This operation should not be ex...
I got it... the uniqueconstraints expect the real db field name which is activityGroup_id and not just activityGroup. One can make sure what the field is called in the DB, by providing the JoinColumn. So, an smart solution is: /** * @ORM\Entity * @ORM\Table(name="activity", * uniqueConstraints={ * @ORM\UniqueConstraint...
OneToMany/ManyToOne SchemaException I try to build a manyToOne relation for my Symfony2 application with Doctrine2. I get this error and I don't know why: app/console doctrine:schema:create PHP Deprecated: Comments starting with '#' are deprecated in /etc/php5/cli/conf.d/mcrypt.ini on line 1 in Unknown on line 0 ATTENT...
TITLE: OneToMany/ManyToOne SchemaException QUESTION: I try to build a manyToOne relation for my Symfony2 application with Doctrine2. I get this error and I don't know why: app/console doctrine:schema:create PHP Deprecated: Comments starting with '#' are deprecated in /etc/php5/cli/conf.d/mcrypt.ini on line 1 in Unknow...
[ "doctrine-orm", "symfony" ]
6
8
1,507
1
0
2011-06-05T00:49:26.633000
2011-06-06T14:37:30.913000
6,240,312
6,240,499
gae Model get_by_id() vs get_by_key_name()
I am wondering about fetching records using Model.get_by_key_name() vs Model.get_by_id() For example, let's say I am returning some JSON that will be used to display a table of records, and for each record, there is a button to delete that record. Suppose I have model 'Foo' and model instance 'foo'. I believe I can ass...
You're confusing a Key name with the stringified Key. They're different. A key's name is something you give an entity via the reserved key_name property at construction time. If you don't, the system will generate an id. An entity key can have either a name or an id, but not both. If you've intentionally stringified a ...
gae Model get_by_id() vs get_by_key_name() I am wondering about fetching records using Model.get_by_key_name() vs Model.get_by_id() For example, let's say I am returning some JSON that will be used to display a table of records, and for each record, there is a button to delete that record. Suppose I have model 'Foo' an...
TITLE: gae Model get_by_id() vs get_by_key_name() QUESTION: I am wondering about fetching records using Model.get_by_key_name() vs Model.get_by_id() For example, let's say I am returning some JSON that will be used to display a table of records, and for each record, there is a button to delete that record. Suppose I h...
[ "python", "google-app-engine" ]
8
11
3,015
2
0
2011-06-05T00:49:28.317000
2011-06-05T01:39:26.473000
6,240,313
6,240,372
Image overwrites table cell border in iTextSharp
I am trying to create a PDF using iTextSharp library (version 4.1.2.0). At the top of the document, I want to add a logo, horizontal line and - below the line - some text (title). I'm trying to achieve this by: creating a PdfPTable with one column size adding to it a PdfPCell with border set to BOTTOM_BORDER containing...
Try adding this: cell.PaddingBottom = 5; So the updated code would be: PdfPTable table = new PdfPTable(1); table.DefaultCell.Border = PdfPCell.NO_BORDER; table.WidthPercentage = 100; Image img = Image.GetInstance("Logo.PNG"); PdfPCell cell = new PdfPCell(img, false); cell.Border = PdfPCell.BOTTOM_BORDER; cell.PaddingB...
Image overwrites table cell border in iTextSharp I am trying to create a PDF using iTextSharp library (version 4.1.2.0). At the top of the document, I want to add a logo, horizontal line and - below the line - some text (title). I'm trying to achieve this by: creating a PdfPTable with one column size adding to it a Pdf...
TITLE: Image overwrites table cell border in iTextSharp QUESTION: I am trying to create a PDF using iTextSharp library (version 4.1.2.0). At the top of the document, I want to add a logo, horizontal line and - below the line - some text (title). I'm trying to achieve this by: creating a PdfPTable with one column size ...
[ "c#", "itext", "border" ]
2
3
9,130
1
0
2011-06-05T00:49:48.633000
2011-06-05T01:04:04.447000
6,240,324
6,240,336
Get a variable after ajax done
I have this code for make some request to my server: function myAjaxCheck(token) { $.ajax({ type: 'POST', url: 'auth.php', data: { token: token, }, dataType: 'json', success: function (data) { if (data.auth == 'OK') { alert ('ok'); } } else { alert('Error: ' + data.auth); } } }).done(function (data) { return data; }); ...
By default, an ajax() request is asynchronous so the call to ajax() will usually return before the request completes. You could make use of a callback function instead. function myAjaxCheck(token, callback) { $.ajax({ type: 'POST', url: 'auth.php', data: { token: token, }, dataType: 'json', success: function (data) { i...
Get a variable after ajax done I have this code for make some request to my server: function myAjaxCheck(token) { $.ajax({ type: 'POST', url: 'auth.php', data: { token: token, }, dataType: 'json', success: function (data) { if (data.auth == 'OK') { alert ('ok'); } } else { alert('Error: ' + data.auth); } } }).done(func...
TITLE: Get a variable after ajax done QUESTION: I have this code for make some request to my server: function myAjaxCheck(token) { $.ajax({ type: 'POST', url: 'auth.php', data: { token: token, }, dataType: 'json', success: function (data) { if (data.auth == 'OK') { alert ('ok'); } } else { alert('Error: ' + data.auth)...
[ "javascript", "jquery", "ajax" ]
5
9
10,022
3
0
2011-06-05T00:52:44.290000
2011-06-05T00:56:56.057000
6,240,326
6,246,836
Live bytes are same as Overall bytes for all rows
I have Xcode 3.2.6 and Instruments 2.7 and I am beginner with those applications. When I run any iPhone project (even simplest navigation controlled app) into Instruments (checking for Memory leak) Live bytes are always same as Overall bytes and they both increase (and sometimes decrease, but not so much as it increase...
If you use the Leaks template, the Allocations instrument is initially configured to track only active allocations. When you track only active allocations, the live bytes and overall bytes are going to be the same. To track all memory allocations instead of only the active allocations, click the Info button next to the...
Live bytes are same as Overall bytes for all rows I have Xcode 3.2.6 and Instruments 2.7 and I am beginner with those applications. When I run any iPhone project (even simplest navigation controlled app) into Instruments (checking for Memory leak) Live bytes are always same as Overall bytes and they both increase (and ...
TITLE: Live bytes are same as Overall bytes for all rows QUESTION: I have Xcode 3.2.6 and Instruments 2.7 and I am beginner with those applications. When I run any iPhone project (even simplest navigation controlled app) into Instruments (checking for Memory leak) Live bytes are always same as Overall bytes and they b...
[ "iphone", "xcode", "instruments" ]
1
2
1,046
1
0
2011-06-05T00:53:12.187000
2011-06-06T00:19:10.380000
6,240,330
6,240,348
Memory alignment check
I want to check whether an allocated memory is aligned or not. I am using _aligned_malloc(size, align); And it returns a pointer. Can I check it by simply dividing the pointer content by 16 for example? If the the pointer content is divisible by 16, does it mean that the memory is aligned by 16 bytes?
An "aligned" pointer by definition means that the numeric value of the pointer is evenly divisible by N (where N is the desired alignment). To check this, cast the pointer to an integer of suitable size, take the modulus N, and check whether the result is zero. In code: bool is_aligned(void *p, int N) { return (int)p %...
Memory alignment check I want to check whether an allocated memory is aligned or not. I am using _aligned_malloc(size, align); And it returns a pointer. Can I check it by simply dividing the pointer content by 16 for example? If the the pointer content is divisible by 16, does it mean that the memory is aligned by 16 b...
TITLE: Memory alignment check QUESTION: I want to check whether an allocated memory is aligned or not. I am using _aligned_malloc(size, align); And it returns a pointer. Can I check it by simply dividing the pointer content by 16 for example? If the the pointer content is divisible by 16, does it mean that the memory ...
[ "c", "visual-studio" ]
19
25
14,418
3
0
2011-06-05T00:54:41.017000
2011-06-05T00:58:52.557000
6,240,332
6,240,347
What data structure to use
I'm looking for the proper data structure for this scenario. I have boost available to use. The code was originally in C#, and I was using a queue there, but I don't believe that was an appropriate choice, and there isnt a C++ equivalent for C#'s queue as far as I can tell. I'm looking at the following properties in te...
std::deque seems to meet all of your requirements. If performance is a real issue for you, you should read GMan's answer to Pre-allocate space for C++ STL queue.
What data structure to use I'm looking for the proper data structure for this scenario. I have boost available to use. The code was originally in C#, and I was using a queue there, but I don't believe that was an appropriate choice, and there isnt a C++ equivalent for C#'s queue as far as I can tell. I'm looking at the...
TITLE: What data structure to use QUESTION: I'm looking for the proper data structure for this scenario. I have boost available to use. The code was originally in C#, and I was using a queue there, but I don't believe that was an appropriate choice, and there isnt a C++ equivalent for C#'s queue as far as I can tell. ...
[ "c++", "data-structures", "boost" ]
3
10
201
3
0
2011-06-05T00:55:31.860000
2011-06-05T00:58:39.473000
6,240,353
6,240,429
How deep should my math background be before tackling SICP?
HI, I've been trying to work my way thru the SICP book, I found myself cribbing some of the online answers but getting the overall ideas of recursive vs. iterative procedures, etc. But I'm getting to the orders of growth section, and the math is really over my head. To give an idea of my math skills, this morning I spe...
Sounds like SICP would be way too heavy for you. Try out HtDP instead for a book that will teach you programming in a similar style but much easier on the math.
How deep should my math background be before tackling SICP? HI, I've been trying to work my way thru the SICP book, I found myself cribbing some of the online answers but getting the overall ideas of recursive vs. iterative procedures, etc. But I'm getting to the orders of growth section, and the math is really over my...
TITLE: How deep should my math background be before tackling SICP? QUESTION: HI, I've been trying to work my way thru the SICP book, I found myself cribbing some of the online answers but getting the overall ideas of recursive vs. iterative procedures, etc. But I'm getting to the orders of growth section, and the math...
[ "math", "scheme" ]
7
6
2,510
4
0
2011-06-05T00:59:41.183000
2011-06-05T01:18:29.143000
6,240,360
6,240,440
Best Database Structure for Orders
I am torn in between two ways of structuring my database for processing orders. I am not sure if one way will be faster than another. If they are going to be equal then it probably should not matter, right? Here is option #1. orders ------- id timestamp userID cartID reviewed approved reviewBy reviewTimestamp reviewDet...
I would look not only at speed but also at functionality. Who cares if it is fast if it limits you too much to be useful. For example, what if you want to review an order twice (the first time you reject something maybe)? Or what if you process the order in two parts? Unless there is a business case why you really will...
Best Database Structure for Orders I am torn in between two ways of structuring my database for processing orders. I am not sure if one way will be faster than another. If they are going to be equal then it probably should not matter, right? Here is option #1. orders ------- id timestamp userID cartID reviewed approved...
TITLE: Best Database Structure for Orders QUESTION: I am torn in between two ways of structuring my database for processing orders. I am not sure if one way will be faster than another. If they are going to be equal then it probably should not matter, right? Here is option #1. orders ------- id timestamp userID cartID...
[ "database-design", "orders" ]
3
4
303
3
0
2011-06-05T01:00:46.397000
2011-06-05T01:21:37.787000
6,240,369
6,240,393
How can I use a JSON encoded array without a URL?
Hi I'm using fullCalendar 1.5.1, and I've created a PHP query that returns almost everything I want to use in the calendar. This is an integrated system so I had to switch to _ASSOC in order to only return a MySQLi asssociative array: GetAll($myquery); $json_result = json_encode($myqueryresult); $GLOBALS["ADODB_FETCH_M...
According to the documentation for Event Object the start date is required and must be specified as the property named start - you're using the name eventstart Note that according to the docs, startParam and endParam are parameters for the JSON feed option for events and don't seem to change the name of the property th...
How can I use a JSON encoded array without a URL? Hi I'm using fullCalendar 1.5.1, and I've created a PHP query that returns almost everything I want to use in the calendar. This is an integrated system so I had to switch to _ASSOC in order to only return a MySQLi asssociative array: GetAll($myquery); $json_result = js...
TITLE: How can I use a JSON encoded array without a URL? QUESTION: Hi I'm using fullCalendar 1.5.1, and I've created a PHP query that returns almost everything I want to use in the calendar. This is an integrated system so I had to switch to _ASSOC in order to only return a MySQLi asssociative array: GetAll($myquery);...
[ "mysql", "json", "events", "fullcalendar" ]
0
1
850
2
0
2011-06-05T01:03:43.183000
2011-06-05T01:10:46.287000
6,240,375
6,240,743
vCard propagate with info from dB via php
Ok like a plonker I thought it would be easy as. We have a popup with clients details in, to look like a vCard ( but heavily styled ) all propagated via our db on the fly. So I just thought yeah no worries, we can use php within the vcard, and parse the relevant info.. so that wneh user clicks d/l link they get the cor...
The following is an example of a VCard file containing information for one person: vCard 2.1: BEGIN:VCARD VERSION:2.1 N:Gump;Forrest FN:Forrest Gump ORG:Bubba Gump Shrimp Co. TITLE:Shrimp Man TEL;WORK;VOICE:(111) 555-1212 TEL;HOME;VOICE: (404) 555-1212 ADR;WORK:;;100 Waters Edge;Baytown;LA;30314;United States of Americ...
vCard propagate with info from dB via php Ok like a plonker I thought it would be easy as. We have a popup with clients details in, to look like a vCard ( but heavily styled ) all propagated via our db on the fly. So I just thought yeah no worries, we can use php within the vcard, and parse the relevant info.. so that ...
TITLE: vCard propagate with info from dB via php QUESTION: Ok like a plonker I thought it would be easy as. We have a popup with clients details in, to look like a vCard ( but heavily styled ) all propagated via our db on the fly. So I just thought yeah no worries, we can use php within the vcard, and parse the releva...
[ "php", "vcf-vcard" ]
0
3
4,191
2
0
2011-06-05T01:05:08.250000
2011-06-05T02:59:39.740000
6,240,376
6,241,136
Configuring tools with an external file in cherrypy
I'm trying to figure out how to configure a tool to run whenever a request is received in cherrypy, using an external configuration file. I've read through the examples in the documentation, but these all embed the configuration into the source file, rather than a separate configuration file. I've read that tools can b...
There is no facility inside of a config file to instantiate a Tool (the cherrypy.Tool(...) part). You need to do that in code. Your 'mytools.py' file should look like this: def print_path(multiplier=1):... cherrypy.tools.print_path = cherrypy.Tool('on_start_resource', print_path)...and then your config file is used to ...
Configuring tools with an external file in cherrypy I'm trying to figure out how to configure a tool to run whenever a request is received in cherrypy, using an external configuration file. I've read through the examples in the documentation, but these all embed the configuration into the source file, rather than a sep...
TITLE: Configuring tools with an external file in cherrypy QUESTION: I'm trying to figure out how to configure a tool to run whenever a request is received in cherrypy, using an external configuration file. I've read through the examples in the documentation, but these all embed the configuration into the source file,...
[ "python", "cherrypy" ]
2
0
586
1
0
2011-06-05T01:05:23.430000
2011-06-05T05:13:38.720000
6,240,379
6,240,387
dojo or jquery javascript send binary file using ajax
I want to upload a static file on my drive like C:\someplace\somefile.doc THe file and location is always the same. I need to do an ajax POST to a url to send this file using only javascript... Could someone provide some idea or example how this could be done using dojo or jquery...is this possible? I seen examples whe...
you cant upload files from your local computer using javascript without using the built in upload function (the form).
dojo or jquery javascript send binary file using ajax I want to upload a static file on my drive like C:\someplace\somefile.doc THe file and location is always the same. I need to do an ajax POST to a url to send this file using only javascript... Could someone provide some idea or example how this could be done using ...
TITLE: dojo or jquery javascript send binary file using ajax QUESTION: I want to upload a static file on my drive like C:\someplace\somefile.doc THe file and location is always the same. I need to do an ajax POST to a url to send this file using only javascript... Could someone provide some idea or example how this co...
[ "javascript", "jquery", "ajax", "file-upload", "dojo" ]
0
1
1,355
2
0
2011-06-05T01:07:09.097000
2011-06-05T01:08:36.727000
6,240,385
6,240,410
Can I use reflection to get an existing variable by providing its name?
I'm taking over somebody's work and there is a lot of duplicated code. For now, I just want to change the following code: (the code I wanted to change is after this block of code) if (Session["opt3PSRAddHrs4"]!= null) { lblDay4AddHrs.Text = "Additional Hours: " + (String)Session["opt3PSRAddHrs4"]; } else { lblDay4AddHr...
Reflection isn't the answer. You should use the Page.FindControl method instead. To find a label at the page level you would use: Label label = (Label)FindControl("lblDay" + i + "AddHrs"); Note that you'll need to use it on the container which holds your labels. For example, if your labels exist within a Panel with ID=...
Can I use reflection to get an existing variable by providing its name? I'm taking over somebody's work and there is a lot of duplicated code. For now, I just want to change the following code: (the code I wanted to change is after this block of code) if (Session["opt3PSRAddHrs4"]!= null) { lblDay4AddHrs.Text = "Additi...
TITLE: Can I use reflection to get an existing variable by providing its name? QUESTION: I'm taking over somebody's work and there is a lot of duplicated code. For now, I just want to change the following code: (the code I wanted to change is after this block of code) if (Session["opt3PSRAddHrs4"]!= null) { lblDay4Add...
[ "c#", "asp.net", "reflection", "refactoring" ]
1
4
321
1
0
2011-06-05T01:08:05.663000
2011-06-05T01:14:05.383000
6,240,389
6,240,403
How do I stop Eclipse's format from messing up my code?
For some reason Eclipse has started messing up my code when I CTRL + SHIFT + F to format. Any line longer than 80 characters is getting wrapped, and lines with comments at the end really get messed up. Before CTRL + SHIFT + F: projectile.setPosition((CAMERA_WIDTH / 2) - (projectile.getWidth() / 2), 800);//projectile ce...
Just adjust the formatter settings to your personal preferences and gusto and you are set. There are LOTS of options and line wrap and line width are some of them
How do I stop Eclipse's format from messing up my code? For some reason Eclipse has started messing up my code when I CTRL + SHIFT + F to format. Any line longer than 80 characters is getting wrapped, and lines with comments at the end really get messed up. Before CTRL + SHIFT + F: projectile.setPosition((CAMERA_WIDTH ...
TITLE: How do I stop Eclipse's format from messing up my code? QUESTION: For some reason Eclipse has started messing up my code when I CTRL + SHIFT + F to format. Any line longer than 80 characters is getting wrapped, and lines with comments at the end really get messed up. Before CTRL + SHIFT + F: projectile.setPosit...
[ "eclipse" ]
3
2
1,231
2
0
2011-06-05T01:09:30.123000
2011-06-05T01:12:26.507000
6,240,391
6,242,210
Symfony/Doctrine Searchable Behavior : How to override search function?
Here is the thing, I have implemented the searchable behavior on my symfony project and it's working fine. The problem is when I try to perform a search with two words or more. The query generated by the search function is like: SELECT COUNT(keyword) AS relevance, id FROM table_index WHERE id IN (SELECT id FROM table_i...
Ok, my bad, I thought that accessing the table_index was impossible because not declared on my schema.yml, but actually it is, thanks to the searchable line. In my search function,Instead of $q = Doctrine_Query::create() ->select('COUNT(e.keyword) AS relevance, e.id') ->from('Table_Index t'); I just had to remove the _...
Symfony/Doctrine Searchable Behavior : How to override search function? Here is the thing, I have implemented the searchable behavior on my symfony project and it's working fine. The problem is when I try to perform a search with two words or more. The query generated by the search function is like: SELECT COUNT(keywor...
TITLE: Symfony/Doctrine Searchable Behavior : How to override search function? QUESTION: Here is the thing, I have implemented the searchable behavior on my symfony project and it's working fine. The problem is when I try to perform a search with two words or more. The query generated by the search function is like: S...
[ "symfony1", "doctrine", "searchable" ]
1
1
688
1
0
2011-06-05T01:10:32.957000
2011-06-05T10:03:09.390000
6,240,392
6,240,461
Overlay progress bar with jQuery
I want to display a progress bar that "overlays" the page, disabling other actions while it's running, kind of like an alert (except you couldn't exit it by clicking anything). What's a fast way to do this in jQuery? I already have the image picked out-- an animated progress bar. Just need a way to properly overlay it.
You can easily implement your own overlay. #overlay { background-color: black; position: fixed; top: 0; right: 0; bottom: 0; left: 0; opacity: 0.2; /* also -moz-opacity, etc. */ z-index: 10; } Then display when your page is loading, or whenever you want to display it.
Overlay progress bar with jQuery I want to display a progress bar that "overlays" the page, disabling other actions while it's running, kind of like an alert (except you couldn't exit it by clicking anything). What's a fast way to do this in jQuery? I already have the image picked out-- an animated progress bar. Just n...
TITLE: Overlay progress bar with jQuery QUESTION: I want to display a progress bar that "overlays" the page, disabling other actions while it's running, kind of like an alert (except you couldn't exit it by clicking anything). What's a fast way to do this in jQuery? I already have the image picked out-- an animated pr...
[ "jquery", "jquery-ui" ]
8
11
20,659
3
0
2011-06-05T01:10:35.347000
2011-06-05T01:27:15.540000
6,240,396
6,240,441
Unable to create Android apps for version 2.1
I'm new to writing android apps. I installed JDK, and the eclipse Android plugin. I've written a simple Hello World app, but I can only make it in Android versions 2.3.1, 2.3.3, 3.0, and 3.1. I'm using a Sprint Samsung Galaxy and I think thats version 2.1. When I try to run the program on my phone, Eclipse can't find i...
First try the helloworld in the emulator, then close the emulator. Restart your computer and install the debug drivers for your phone. Find them in the manufacturer's site. Then put your phone in charge only. If it doesn't work, try the other modes. Be aware that it doesn't get the connection instantly, it may take som...
Unable to create Android apps for version 2.1 I'm new to writing android apps. I installed JDK, and the eclipse Android plugin. I've written a simple Hello World app, but I can only make it in Android versions 2.3.1, 2.3.3, 3.0, and 3.1. I'm using a Sprint Samsung Galaxy and I think thats version 2.1. When I try to run...
TITLE: Unable to create Android apps for version 2.1 QUESTION: I'm new to writing android apps. I installed JDK, and the eclipse Android plugin. I've written a simple Hello World app, but I can only make it in Android versions 2.3.1, 2.3.3, 3.0, and 3.1. I'm using a Sprint Samsung Galaxy and I think thats version 2.1....
[ "android", "eclipse-plugin" ]
0
0
209
2
0
2011-06-05T01:10:59.107000
2011-06-05T01:21:39.207000
6,240,409
6,240,723
Drawing many UIBezierPaths in a view
I am drawing several UIBezierPath s on a view based on finger movements. Every time a cycle of touches -- Began/Moved/Ended -- completes, I store the points and create a UIBezierPath that is stored in an array called bezierArray. I have another array called bezierArrayColors that stores the colors of each path. The pro...
Make sure that you pay attention to the rect that's passed into -drawRect:. If your code takes the easy way out and redraws the entire view every time -drawRect: is called, you may be doing far more drawing than necessary at least some of the time.
Drawing many UIBezierPaths in a view I am drawing several UIBezierPath s on a view based on finger movements. Every time a cycle of touches -- Began/Moved/Ended -- completes, I store the points and create a UIBezierPath that is stored in an array called bezierArray. I have another array called bezierArrayColors that st...
TITLE: Drawing many UIBezierPaths in a view QUESTION: I am drawing several UIBezierPath s on a view based on finger movements. Every time a cycle of touches -- Began/Moved/Ended -- completes, I store the points and create a UIBezierPath that is stored in an array called bezierArray. I have another array called bezierA...
[ "ios", "objective-c", "cocoa-touch", "quartz-graphics", "uibezierpath" ]
6
6
4,551
3
0
2011-06-05T01:13:26.440000
2011-06-05T02:53:55.130000
6,240,414
6,240,428
Add http:// prefix to URL when missing
Hello I have a very simple code Website The problem is that if the user does not enter http:// the link will then point to my website and not to the external website as it should. How do I check in PHP if the user has not entered http:// and automatically add it when it is not there?
A simple solution which may not work in all cases (i.e. 'https://'): if (strpos($aProfileInfo['Website'],'http://') === false){ $aProfileInfo['Website'] = 'http://'.$aProfileInfo['Website']; }
Add http:// prefix to URL when missing Hello I have a very simple code Website The problem is that if the user does not enter http:// the link will then point to my website and not to the external website as it should. How do I check in PHP if the user has not entered http:// and automatically add it when it is not the...
TITLE: Add http:// prefix to URL when missing QUESTION: Hello I have a very simple code Website The problem is that if the user does not enter http:// the link will then point to my website and not to the external website as it should. How do I check in PHP if the user has not entered http:// and automatically add it ...
[ "php", "http", "html", "anchor", "href" ]
41
20
48,023
10
0
2011-06-05T01:15:11.607000
2011-06-05T01:18:22.620000
6,240,417
6,240,493
How do I move a live website to my local machine with mamp
I am trying to move a site from a live URL to my local MAMP environment. How could I do this as I am having a real pain in the back side doing this as wp-admin keeps on redirecting me to my live site or saying certain pages don't exist.
I'm assuming you've already copied your entire WordPress directory from your web server to your local MAMP folder. To take care of the database and URLs, I find it easiest to export the entire DB from your web server using phpMyAdmin or similar, then run find and replace on the exported SQL file to replace your old url...
How do I move a live website to my local machine with mamp I am trying to move a site from a live URL to my local MAMP environment. How could I do this as I am having a real pain in the back side doing this as wp-admin keeps on redirecting me to my live site or saying certain pages don't exist.
TITLE: How do I move a live website to my local machine with mamp QUESTION: I am trying to move a site from a live URL to my local MAMP environment. How could I do this as I am having a real pain in the back side doing this as wp-admin keeps on redirecting me to my live site or saying certain pages don't exist. ANSWE...
[ "wordpress", "mamp" ]
2
1
5,179
4
0
2011-06-05T01:16:48.747000
2011-06-05T01:38:31.840000
6,240,423
6,259,681
This javascript runs slowly in Firefox, how can I make it run smoothly?
I've got a menubar that uses a bit of javascript for a nice effect. The hover effect runs smoothly in google chrome, safari and even internet explorer. I've tried removing the images, that doesn't seem to do it. I tried disable Here's the javascript: $(function() { $('#sdt_menu > li').bind('mouseenter',function(){ var ...
The problem was with underlying images. I changed them to divs and set them as backgrounds and it worked like a charm. No idea why Firefox has such a problem displaying under my javascript then is did.
This javascript runs slowly in Firefox, how can I make it run smoothly? I've got a menubar that uses a bit of javascript for a nice effect. The hover effect runs smoothly in google chrome, safari and even internet explorer. I've tried removing the images, that doesn't seem to do it. I tried disable Here's the javascrip...
TITLE: This javascript runs slowly in Firefox, how can I make it run smoothly? QUESTION: I've got a menubar that uses a bit of javascript for a nice effect. The hover effect runs smoothly in google chrome, safari and even internet explorer. I've tried removing the images, that doesn't seem to do it. I tried disable He...
[ "javascript", "html", "css", "menu", "easing" ]
1
0
442
2
0
2011-06-05T01:17:49.870000
2011-06-07T01:04:31.963000
6,240,424
6,240,445
ModelChoiceField labels are incorrect
Not sure how to update the labels on a ModelChoiceField Model: class Category(models.Model): categoryText = models.CharField(max_length=50) parentCat = models.ForeignKey('self',null=True,blank=True) Form: class CategoryForm(forms.Form): category = forms.ModelChoiceField(queryset=Category.objects.all()) Right now when ...
class Category(models.Model): categoryText = models.CharField(max_length=50) parentCat = models.ForeignKey('self',null=True,blank=True) def __unicode__(self): return self.categoryText The unicode method is used internally by Django when it want's to print a human-friendly version of the particular model object/table r...
ModelChoiceField labels are incorrect Not sure how to update the labels on a ModelChoiceField Model: class Category(models.Model): categoryText = models.CharField(max_length=50) parentCat = models.ForeignKey('self',null=True,blank=True) Form: class CategoryForm(forms.Form): category = forms.ModelChoiceField(queryset=C...
TITLE: ModelChoiceField labels are incorrect QUESTION: Not sure how to update the labels on a ModelChoiceField Model: class Category(models.Model): categoryText = models.CharField(max_length=50) parentCat = models.ForeignKey('self',null=True,blank=True) Form: class CategoryForm(forms.Form): category = forms.ModelChoi...
[ "django", "django-forms" ]
0
2
725
1
0
2011-06-05T01:17:57.410000
2011-06-05T01:23:47.050000
6,240,430
6,243,860
Flex can't add module as DisplayObject
i'm trying to load a module and add it to a mx:box object called "mod". Here my Code: var m:IModuleInfo = ModuleManager.getModule("modules/Module_Category.swf"); m.addEventListener(ModuleEvent.READY, function(e:Event):void { this.mod.addChild(m.factory.create() as DisplayObject); }); m.load(); the Problem is that when ...
Your 'this' scope is incorrect. You are using 'this' inside an anonymous function. Inside that function, 'this' refers to the function itself, not the class that you were probably aiming for. I can't see the rest of your class, but I can see that the 'this' scope does not have a property 'mod', hence your code will fai...
Flex can't add module as DisplayObject i'm trying to load a module and add it to a mx:box object called "mod". Here my Code: var m:IModuleInfo = ModuleManager.getModule("modules/Module_Category.swf"); m.addEventListener(ModuleEvent.READY, function(e:Event):void { this.mod.addChild(m.factory.create() as DisplayObject); ...
TITLE: Flex can't add module as DisplayObject QUESTION: i'm trying to load a module and add it to a mx:box object called "mod". Here my Code: var m:IModuleInfo = ModuleManager.getModule("modules/Module_Category.swf"); m.addEventListener(ModuleEvent.READY, function(e:Event):void { this.mod.addChild(m.factory.create() a...
[ "flash", "apache-flex", "actionscript-3", "flex4" ]
0
3
280
1
0
2011-06-05T01:18:47.240000
2011-06-05T15:32:08.537000
6,240,434
6,240,588
comparing a string of arrays and build the unmatched list
Update1: this is all looks great but there is big problem which i have been looking for and so far i havent found that yet. - see my comments in the code. var custNames = LoadCustNames(); var custFirstInitials = (from cn in custNames select cn.Name.Substring(0, 1).ToLower() ).Distinct(); foreach (var item in custFirstI...
Disable it but still leave as href (clicking it won't do anything but would still look like active link) b.InnerHtml = " " + nextRole.ToUpper().ToString() + " "; Don't display as href b.InnerHtml = " " + nextRole.ToUpper().ToString() + " "; Use css class WhateverClassForStyle to style it the way you want. I guess you a...
comparing a string of arrays and build the unmatched list Update1: this is all looks great but there is big problem which i have been looking for and so far i havent found that yet. - see my comments in the code. var custNames = LoadCustNames(); var custFirstInitials = (from cn in custNames select cn.Name.Substring(0, ...
TITLE: comparing a string of arrays and build the unmatched list QUESTION: Update1: this is all looks great but there is big problem which i have been looking for and so far i havent found that yet. - see my comments in the code. var custNames = LoadCustNames(); var custFirstInitials = (from cn in custNames select cn....
[ "asp.net" ]
0
0
662
2
0
2011-06-05T01:19:40.197000
2011-06-05T02:04:38.450000
6,240,438
6,240,963
Outer Join with ORM mapping in SQLAlchemy
I am using the ORM Mapping in SQLAlchemy 0.6.8. I have three tables (A, B and C), with no foreign keys between them. I am trying to join table A and B, and then left outer join that with C. I am expecting a named tuple, with fields A, B and C - with the C field sometimes set to None.) I can do the first join easily eno...
This should work: (session.query(A).join(B, A.some_field == B.some_other_field).outerjoin(C, A.some_field == C.some_different_field).add_entity(B).add_entity(C))
Outer Join with ORM mapping in SQLAlchemy I am using the ORM Mapping in SQLAlchemy 0.6.8. I have three tables (A, B and C), with no foreign keys between them. I am trying to join table A and B, and then left outer join that with C. I am expecting a named tuple, with fields A, B and C - with the C field sometimes set to...
TITLE: Outer Join with ORM mapping in SQLAlchemy QUESTION: I am using the ORM Mapping in SQLAlchemy 0.6.8. I have three tables (A, B and C), with no foreign keys between them. I am trying to join table A and B, and then left outer join that with C. I am expecting a named tuple, with fields A, B and C - with the C fiel...
[ "orm", "join", "sqlalchemy", "outer-join" ]
14
18
11,285
2
0
2011-06-05T01:21:18.693000
2011-06-05T04:13:33.297000
6,240,444
6,240,523
Codeigniter use validation callback to change submitted value
I have a text input where users submit CSV e.g. red, blue, red, yellow If the user submits duplicate values for instance red as seen above I want to remove the duplicate. I started making a callback but I'm not sure how to complete it. //callback rule function _remove_dublicate($str) { $val = strtolower($str); //make e...
Despite the comments, this is a perfectly valid reason to use a callback, similar to the "prep" rules that actually change the value of the input submitted (for instance: trim, xss_clean, strtolower). You're on the right track, all you have to do is return $result in your callback and it will alter the input, but make ...
Codeigniter use validation callback to change submitted value I have a text input where users submit CSV e.g. red, blue, red, yellow If the user submits duplicate values for instance red as seen above I want to remove the duplicate. I started making a callback but I'm not sure how to complete it. //callback rule functi...
TITLE: Codeigniter use validation callback to change submitted value QUESTION: I have a text input where users submit CSV e.g. red, blue, red, yellow If the user submits duplicate values for instance red as seen above I want to remove the duplicate. I started making a callback but I'm not sure how to complete it. //ca...
[ "php", "forms", "codeigniter", "callback" ]
3
7
4,243
2
0
2011-06-05T01:22:42.863000
2011-06-05T01:47:27.203000
6,240,450
6,240,535
Bit operation question
Is there a way to find the bit that has been set the least amount of times from using only bit operations? For example, if I have three bit arrays: 11011001 11100000 11101101 the bits in position 3 and 5 are set to 1 in only 1 of the three vectors. I currently have an o(n) solution where n is the number of bits in the...
You can use a duplicate/shift/mask approach to separate the bits and maybe be a little faster than an iterative bit shift scheme, if the total number of values is limited. Eg for each "bits" 8-bit value, assuming no more than 15 values: bits1 = (bits >> 3) & 0x11; bits2 = (bits >> 2) & 0x11; bits3 = (bits >> 1) & 0x11;...
Bit operation question Is there a way to find the bit that has been set the least amount of times from using only bit operations? For example, if I have three bit arrays: 11011001 11100000 11101101 the bits in position 3 and 5 are set to 1 in only 1 of the three vectors. I currently have an o(n) solution where n is th...
TITLE: Bit operation question QUESTION: Is there a way to find the bit that has been set the least amount of times from using only bit operations? For example, if I have three bit arrays: 11011001 11100000 11101101 the bits in position 3 and 5 are set to 1 in only 1 of the three vectors. I currently have an o(n) solu...
[ "bit" ]
6
4
1,271
5
0
2011-06-05T01:24:46.050000
2011-06-05T01:51:04.030000
6,240,465
6,243,043
Android Google Wallet
Is it possible for an third-party application to use Android services (with appropriate Intent Filter) to listen to transaction made using Google Wallet? Basically can a third-party application sniff what kind of product was bought?
Since there is neither an Android version supporting Google Wallet at the moment neither a Google Wallet app, there is only speculation left at this point of time.
Android Google Wallet Is it possible for an third-party application to use Android services (with appropriate Intent Filter) to listen to transaction made using Google Wallet? Basically can a third-party application sniff what kind of product was bought?
TITLE: Android Google Wallet QUESTION: Is it possible for an third-party application to use Android services (with appropriate Intent Filter) to listen to transaction made using Google Wallet? Basically can a third-party application sniff what kind of product was bought? ANSWER: Since there is neither an Android vers...
[ "android" ]
6
0
564
1
0
2011-06-05T01:28:22.953000
2011-06-05T13:01:09.080000
6,240,480
6,240,531
jQuery DOM Traversal
I'm having trouble finding the easiest path to an item using jQuery (although the solution doesn't have to necessarily use jQuery, it's just available as a tool). Here is a simplified code sample: Bob Jones Workshop 06/04/11 Delete I'm looking to get the word "Workshop" when the "Delete" link is clicked, and I'm wonder...
This simple schema is often the best: Say in plain English what you want to find. Treat the result as pseudo-code. Literally translate it to code. In your case, it's probably: I need on the row to which the clicked element belongs. This translates directly to your b) option: $(this).closest("tr").find("td.class-name")
jQuery DOM Traversal I'm having trouble finding the easiest path to an item using jQuery (although the solution doesn't have to necessarily use jQuery, it's just available as a tool). Here is a simplified code sample: Bob Jones Workshop 06/04/11 Delete I'm looking to get the word "Workshop" when the "Delete" link is cl...
TITLE: jQuery DOM Traversal QUESTION: I'm having trouble finding the easiest path to an item using jQuery (although the solution doesn't have to necessarily use jQuery, it's just available as a tool). Here is a simplified code sample: Bob Jones Workshop 06/04/11 Delete I'm looking to get the word "Workshop" when the "...
[ "javascript", "jquery", "dom-traversal" ]
3
3
440
3
0
2011-06-05T01:34:38.737000
2011-06-05T01:50:11.533000
6,240,483
6,240,659
Dynamically add views and handle their events
I hope this is any easy one. I have a view that I want to add and remove view (buttons, imagebuttons, etc) dynamically. I also want to respond to the events triggered by these views across all my activities. So, in other words I have a basic view, that I need to add and remove buttons as necessary. When these buttons a...
You could create a reference to the parent layout and then use addView() on the parent to dynamically add a Button or whatever. With addView() you can set the new layout parameters for the button so as to control it's position. Defining the OnClickListener's for each of the button's is possible as well. Let me know if ...
Dynamically add views and handle their events I hope this is any easy one. I have a view that I want to add and remove view (buttons, imagebuttons, etc) dynamically. I also want to respond to the events triggered by these views across all my activities. So, in other words I have a basic view, that I need to add and rem...
TITLE: Dynamically add views and handle their events QUESTION: I hope this is any easy one. I have a view that I want to add and remove view (buttons, imagebuttons, etc) dynamically. I also want to respond to the events triggered by these views across all my activities. So, in other words I have a basic view, that I n...
[ "android", "view", "android-activity" ]
2
3
526
1
0
2011-06-05T01:36:15.227000
2011-06-05T02:30:02.493000
6,240,484
6,241,864
Profiling in go
What's the best way to get profiling information about my go program? I've seen references to pprof, but documentation seems scarce compared to other areas of Go.
Have a look at the 6prof command. Note that it's for all architectures, despite its name. For reasons of disambiguation it is installed as 6prof although it also serves as an 8prof and a 5prof.
Profiling in go What's the best way to get profiling information about my go program? I've seen references to pprof, but documentation seems scarce compared to other areas of Go.
TITLE: Profiling in go QUESTION: What's the best way to get profiling information about my go program? I've seen references to pprof, but documentation seems scarce compared to other areas of Go. ANSWER: Have a look at the 6prof command. Note that it's for all architectures, despite its name. For reasons of disambigu...
[ "performance", "go" ]
4
2
236
1
0
2011-06-05T01:36:38.547000
2011-06-05T08:49:16.547000
6,240,497
6,244,809
How do I recover a control that's been trapped beyond a Frame edge?
This affects just Frames and I've encountered it only in Excel 11, but since it's obviously a bug it may have been fixed in later versions which I haven't tried. If you use Frames a lot, this WILL eventually bite you. The Problem Start with a Frame and any other control contained in that Frame, let's say a Label. Grab ...
@Chris, thanks for the response, but something I didn't mention is that on my running form, at any given time there may be 50-100 controls that have been moved (temporarily) outside of their containing frames, and your method would find all of these. This would still be ok if I always knew the name of the missing contr...
How do I recover a control that's been trapped beyond a Frame edge? This affects just Frames and I've encountered it only in Excel 11, but since it's obviously a bug it may have been fixed in later versions which I haven't tried. If you use Frames a lot, this WILL eventually bite you. The Problem Start with a Frame and...
TITLE: How do I recover a control that's been trapped beyond a Frame edge? QUESTION: This affects just Frames and I've encountered it only in Excel 11, but since it's obviously a bug it may have been fixed in later versions which I haven't tried. If you use Frames a lot, this WILL eventually bite you. The Problem Star...
[ "vba", "excel", "userform" ]
4
0
3,618
3
0
2011-06-05T01:39:03.993000
2011-06-05T18:08:42.877000
6,240,498
6,240,579
How to open link in UIWebview in Safari
I have a webview displayed in a scrollview and flip view and need to find a way to open links when clicked in safari (not in the app)! I would appriciate any help as im stuck for hours in this! ArticleScrollVC.h // ArticleScrollVC.h #import #import "PagedScrollview.h" #import "OMPageControl.h" #define VIEW_FRONT_TAG ...
Adopt the UIWebViewDelegate protocol in your view controller, and then implement -webView:shouldStartLoadWithRequest:navigationType: such that it sends the application an -openURL: message with the url and returns NO to prevent the web view from opening it.
How to open link in UIWebview in Safari I have a webview displayed in a scrollview and flip view and need to find a way to open links when clicked in safari (not in the app)! I would appriciate any help as im stuck for hours in this! ArticleScrollVC.h // ArticleScrollVC.h #import #import "PagedScrollview.h" #import "O...
TITLE: How to open link in UIWebview in Safari QUESTION: I have a webview displayed in a scrollview and flip view and need to find a way to open links when clicked in safari (not in the app)! I would appriciate any help as im stuck for hours in this! ArticleScrollVC.h // ArticleScrollVC.h #import #import "PagedScroll...
[ "iphone", "ios", "safari", "uiwebview" ]
0
1
1,446
2
0
2011-06-05T01:39:22.370000
2011-06-05T02:01:47.190000
6,240,501
6,240,548
devise and authentication
I've been trying all day to get a way to authenticate via a simple get. class ApiController < ApplicationController def signin warden.authenticate(params[:email], params[:password]) render:json => current_user.to_json end end When I hit this with something like http://localhost:3000/api/signin?email=theemailaddress&pas...
You need to define a custom warden strategy and check the request headers. Look at what I did here.
devise and authentication I've been trying all day to get a way to authenticate via a simple get. class ApiController < ApplicationController def signin warden.authenticate(params[:email], params[:password]) render:json => current_user.to_json end end When I hit this with something like http://localhost:3000/api/signin...
TITLE: devise and authentication QUESTION: I've been trying all day to get a way to authenticate via a simple get. class ApiController < ApplicationController def signin warden.authenticate(params[:email], params[:password]) render:json => current_user.to_json end end When I hit this with something like http://localho...
[ "ruby-on-rails", "ruby", "devise", "warden" ]
2
2
2,000
1
0
2011-06-05T01:40:39.500000
2011-06-05T01:54:18.063000
6,240,507
6,240,557
Stack problems in Java
I'm having some problems with the stack in java... I'm implementing quicksort using an ArrayList- I'll attach my full code at the end but here are the relevant bits (Keep in mind I've been debugging the hell out of this for a few hours with absolutely no clue what was going wrong, so where you see things done in odd/et...
As you noted, Quicksort has worst case performance when provided a sorted array and ends up making O(n) recursive calls because the partitioning only removes one element during each subdivision step. In the other cases where the array is not sorted, the partitioning is more effective, so you end up with O(lgN) recursiv...
Stack problems in Java I'm having some problems with the stack in java... I'm implementing quicksort using an ArrayList- I'll attach my full code at the end but here are the relevant bits (Keep in mind I've been debugging the hell out of this for a few hours with absolutely no clue what was going wrong, so where you se...
TITLE: Stack problems in Java QUESTION: I'm having some problems with the stack in java... I'm implementing quicksort using an ArrayList- I'll attach my full code at the end but here are the relevant bits (Keep in mind I've been debugging the hell out of this for a few hours with absolutely no clue what was going wron...
[ "java", "eclipse", "stack", "stack-overflow", "quicksort" ]
1
3
674
2
0
2011-06-05T01:42:47.067000
2011-06-05T01:56:04.963000
6,240,508
6,240,517
Why does ReadProcessMemory always return zeros?
Given the code below, ReadProcessMemory always returns an array of zeros. I'm trying to locate a string (which may be numeric) in a running process and identify all the locations where that string exists. But ReadProcessMemory always returns an array of zeros. Why is that? I've tried running VS as administrator and rem...
I was opening the handle with the wrong access type. 0x0010 is to read; 0x0020 is to write. I was hoping to get read/write with one open, but it looks like I'll have to handle that separately. source: http://www.codeproject.com/script/Articles/ViewDownloads.aspx?aid=15680
Why does ReadProcessMemory always return zeros? Given the code below, ReadProcessMemory always returns an array of zeros. I'm trying to locate a string (which may be numeric) in a running process and identify all the locations where that string exists. But ReadProcessMemory always returns an array of zeros. Why is that...
TITLE: Why does ReadProcessMemory always return zeros? QUESTION: Given the code below, ReadProcessMemory always returns an array of zeros. I'm trying to locate a string (which may be numeric) in a running process and identify all the locations where that string exists. But ReadProcessMemory always returns an array of ...
[ "c#", "winapi", "memory", "interop", "kernel32" ]
0
0
2,679
1
0
2011-06-05T01:42:52.167000
2011-06-05T01:46:21.977000
6,240,512
6,247,497
How do I get Eclipse to see Scala sources in a jar?
I get the following Eclipse error when browsing a binary scala jar dependency: Source not found The source attachment does not contain the source for the file Http.class You can change the source attachment by clicking Change Attached Source below The source attachment is a jar file containing the.scala source files, ...
You should make sure to match your package structure with your directory structure as required in java.
How do I get Eclipse to see Scala sources in a jar? I get the following Eclipse error when browsing a binary scala jar dependency: Source not found The source attachment does not contain the source for the file Http.class You can change the source attachment by clicking Change Attached Source below The source attachme...
TITLE: How do I get Eclipse to see Scala sources in a jar? QUESTION: I get the following Eclipse error when browsing a binary scala jar dependency: Source not found The source attachment does not contain the source for the file Http.class You can change the source attachment by clicking Change Attached Source below T...
[ "eclipse", "scala", "sbt" ]
4
2
1,155
2
0
2011-06-05T01:43:55.160000
2011-06-06T03:20:12.407000
6,240,515
6,240,569
Allow Driver to Stop in Windows?
Some drivers on Windows, like Null and Beep, can be arbitrarily stopped and re-started through the ControlService(..., SERVICE_CONTROL_STOP,...) operation. Most other drivers, however, cannot be stopped and restarted while the system is running. I'm making my own driver. How can I tell Windows that my driver can be sto...
It turns out that you need to add a DriverUnload function: VOID NTAPI DriverUnload(IN DRIVER_OBJECT *DriverObject) { } NTSTATUS NTAPI DriverEntry(IN PDRIVER_OBJECT DriverObject, IN PUNICODE_STRING RegistryPath) { DriverObject->DriverUnload = DriverUnload; // <--- add this return STATUS_SUCCESS; } However, this is only...
Allow Driver to Stop in Windows? Some drivers on Windows, like Null and Beep, can be arbitrarily stopped and re-started through the ControlService(..., SERVICE_CONTROL_STOP,...) operation. Most other drivers, however, cannot be stopped and restarted while the system is running. I'm making my own driver. How can I tell ...
TITLE: Allow Driver to Stop in Windows? QUESTION: Some drivers on Windows, like Null and Beep, can be arbitrarily stopped and re-started through the ControlService(..., SERVICE_CONTROL_STOP,...) operation. Most other drivers, however, cannot be stopped and restarted while the system is running. I'm making my own drive...
[ "winapi", "driver" ]
1
0
643
1
0
2011-06-05T01:45:49.230000
2011-06-05T01:59:35.807000
6,240,516
6,240,542
I'm still confused about sanitizing strings
I am coding for an Intranet. In theory, I don't have to worry too much about SQL injection (I can see you throwing up your hands in horror already;-) It's not really a secure app & doesn't have any "secret stuff". I'm more concerned about storing and retrieving strings which contain quotes. It has to use ODBC function ...
Use parameterized queries / statements. The odbc prepare and execute functionality provides you this feature like so: There is some limitation with regards to parameters that begin and end /w single quotes, see here: http://php.net/manual/en/function.odbc-execute.php Validate input as best you can prior to putting it i...
I'm still confused about sanitizing strings I am coding for an Intranet. In theory, I don't have to worry too much about SQL injection (I can see you throwing up your hands in horror already;-) It's not really a secure app & doesn't have any "secret stuff". I'm more concerned about storing and retrieving strings which ...
TITLE: I'm still confused about sanitizing strings QUESTION: I am coding for an Intranet. In theory, I don't have to worry too much about SQL injection (I can see you throwing up your hands in horror already;-) It's not really a secure app & doesn't have any "secret stuff". I'm more concerned about storing and retriev...
[ "php", "odbc", "sql-injection", "quotes" ]
0
3
233
1
0
2011-06-05T01:46:00.387000
2011-06-05T01:53:05.360000
6,240,520
6,241,510
Can I set up ReSharper to rename unimported classes usages to their full names instead of importing their namespaces?
When I try to use a class whose home namespace is not imported with a using directive, a pop-up appears allowing me to choose the class (by its full name) and adds a using directive to import it. In a project of mine I make heavy use of same-named classes from different namespaces and would prefer to specify a full nam...
Send this question to the ReSharper support team. They'll be happy to help you out. BTW, this feature is already in Visual Studio, try pressing Ctrl +. (period) and select the full name. I don't have this problem, and it works fine for me using Visual Studio and ReSharper side by side.
Can I set up ReSharper to rename unimported classes usages to their full names instead of importing their namespaces? When I try to use a class whose home namespace is not imported with a using directive, a pop-up appears allowing me to choose the class (by its full name) and adds a using directive to import it. In a p...
TITLE: Can I set up ReSharper to rename unimported classes usages to their full names instead of importing their namespaces? QUESTION: When I try to use a class whose home namespace is not imported with a using directive, a pop-up appears allowing me to choose the class (by its full name) and adds a using directive to...
[ "c#", ".net", "namespaces", "refactoring", "resharper" ]
3
4
107
1
0
2011-06-05T01:46:53.890000
2011-06-05T07:17:35.317000
6,240,521
6,240,536
Nginx static media, and problems with trailing slashes
Sigh... just when I thought I had figured out all the issues with trailing slashes in URLs for Django - and I start working with nginx... So I'm configuring nginx to serve static media, and failing repeatedly - despite my config looking exactly like all the other static-media questions on SO. Eventually I realize that ...
Having the slash in the request will make most servers assume that you want the hello.css folder in the css folder. Obviously, that's going to confuse it. Shouldn't URLs end in trailing slashes? Nope. Do a view-source for this page, or almost any other. See? No trailing slash.
Nginx static media, and problems with trailing slashes Sigh... just when I thought I had figured out all the issues with trailing slashes in URLs for Django - and I start working with nginx... So I'm configuring nginx to serve static media, and failing repeatedly - despite my config looking exactly like all the other s...
TITLE: Nginx static media, and problems with trailing slashes QUESTION: Sigh... just when I thought I had figured out all the issues with trailing slashes in URLs for Django - and I start working with nginx... So I'm configuring nginx to serve static media, and failing repeatedly - despite my config looking exactly li...
[ "nginx" ]
0
1
1,320
1
0
2011-06-05T01:46:57.130000
2011-06-05T01:51:32.627000
6,240,527
6,240,560
Index manipulation of array in C
Begining with an ordered array [1, 2, 3, 4, 5, 6, 8, 9, 10] How would be the way to get every iteration the following results? 1 2 3 4 5 6 7 8 9 10 1 3 4 5 6 7 8 9 10 2 1 4 5 6 7 8 9 10 2 3 1 5 6 7 8 9 10 2 3 4 1 6 7 8 9 10 2 3 4 5 1 7 8 9 10 2 3 4 5 6 1 8 9 10 2 3 4 5 6 7 1 9 10 2 3 4 5 6 7 8 1 10 2 3 4 5 6 7 8 9 #in...
C arrays are indexed from 0. So when you access elements from 1 to MAX, you are running off the end of the array. Have your loops go from 0 to MAX-1. Customary way to write it is for (i=0; i < MAX; ++i)...so anybody reading your code can immediately prove that the array index never equals MAX.
Index manipulation of array in C Begining with an ordered array [1, 2, 3, 4, 5, 6, 8, 9, 10] How would be the way to get every iteration the following results? 1 2 3 4 5 6 7 8 9 10 1 3 4 5 6 7 8 9 10 2 1 4 5 6 7 8 9 10 2 3 1 5 6 7 8 9 10 2 3 4 1 6 7 8 9 10 2 3 4 5 1 7 8 9 10 2 3 4 5 6 1 8 9 10 2 3 4 5 6 7 1 9 10 2 3 4 ...
TITLE: Index manipulation of array in C QUESTION: Begining with an ordered array [1, 2, 3, 4, 5, 6, 8, 9, 10] How would be the way to get every iteration the following results? 1 2 3 4 5 6 7 8 9 10 1 3 4 5 6 7 8 9 10 2 1 4 5 6 7 8 9 10 2 3 1 5 6 7 8 9 10 2 3 4 1 6 7 8 9 10 2 3 4 5 1 7 8 9 10 2 3 4 5 6 1 8 9 10 2 3 4 5...
[ "c", "arrays" ]
2
3
209
2
0
2011-06-05T01:49:30.677000
2011-06-05T01:56:39.247000
6,240,529
6,240,625
jQuery serialize how to eliminate empty fields
In this form users can add some info for Authors (music, lyric authors) The users have the option to add 1 or more authors. The problem is that when the user enters only 1 author all the other inputs remain empty, but the jQuery serialize function will put them anyway in the URL and the server gives me this error: Requ...
Try adding this $('input', '#submForm').each(function(){ $(this).val() == "" && $(this).remove(); }) OR $('input:text[value=""]', '#submForm').remove(); before var serialized = $('#submForm').serialize()
jQuery serialize how to eliminate empty fields In this form users can add some info for Authors (music, lyric authors) The users have the option to add 1 or more authors. The problem is that when the user enters only 1 author all the other inputs remain empty, but the jQuery serialize function will put them anyway in t...
TITLE: jQuery serialize how to eliminate empty fields QUESTION: In this form users can add some info for Authors (music, lyric authors) The users have the option to add 1 or more authors. The problem is that when the user enters only 1 author all the other inputs remain empty, but the jQuery serialize function will pu...
[ "jquery", "serialization" ]
5
1
19,086
11
0
2011-06-05T01:49:34.257000
2011-06-05T02:18:19.933000
6,240,541
6,240,550
How can NHibernate make Unit Test Easy?
NHibernate uses XML files to map the classes to the tables in the database. How can unit testing XML files be easier than program code (C#, JAVA, etc.)? Does NHibernate assume that the mapping XML files are automatically perfect and there is no need to test them?
Unit test your DAO, which encapsulates your NHibernate queries, to verify that your NHibernate configuration/mappings are correct.
How can NHibernate make Unit Test Easy? NHibernate uses XML files to map the classes to the tables in the database. How can unit testing XML files be easier than program code (C#, JAVA, etc.)? Does NHibernate assume that the mapping XML files are automatically perfect and there is no need to test them?
TITLE: How can NHibernate make Unit Test Easy? QUESTION: NHibernate uses XML files to map the classes to the tables in the database. How can unit testing XML files be easier than program code (C#, JAVA, etc.)? Does NHibernate assume that the mapping XML files are automatically perfect and there is no need to test them...
[ "unit-testing", "nhibernate", "orm" ]
0
0
269
4
0
2011-06-05T01:52:45.537000
2011-06-05T01:54:37.583000
6,240,544
6,240,583
Best solution to remove duplicate values from case-insensitive array
I found a few solutions but I can't decide which one to use. What is the most compact and effective solution to use php's array_unique() function on a case-insensitive array? Example: $input = array('green', 'Green', 'blue', 'yellow', 'blue'); $result = array_unique($input); print_r($result); Result: Array ( [0] => gre...
Would this work? $r = array_intersect_key($input, array_unique(array_map('strtolower', $input))); Doesn't care about the specific case to keep but does the job, you can also try to call asort($input); before the intersect to keep the capitalized values instead ( demo at IDEOne.com ).
Best solution to remove duplicate values from case-insensitive array I found a few solutions but I can't decide which one to use. What is the most compact and effective solution to use php's array_unique() function on a case-insensitive array? Example: $input = array('green', 'Green', 'blue', 'yellow', 'blue'); $result...
TITLE: Best solution to remove duplicate values from case-insensitive array QUESTION: I found a few solutions but I can't decide which one to use. What is the most compact and effective solution to use php's array_unique() function on a case-insensitive array? Example: $input = array('green', 'Green', 'blue', 'yellow'...
[ "php", "arrays", "function", "array-unique" ]
5
14
6,374
5
0
2011-06-05T01:53:31.790000
2011-06-05T02:03:24.100000
6,240,547
6,259,324
Changing text layout in a UILabel - Specifically where it starts from
I have this problem with one of my UILabels, I would like to have the text that it displays begin being drawn at the top left of the label rather than the middle left. Current screen: As you can see the word "Description" in the label appears in the centre and to the left of the label. I would like it to start at the t...
Changing the Description label to a UITextView pretty much solved my problem. It allowed for multiple lines of text and was much simpler to implement. Also looked a little prettier. Thanks for your help, particularly Daniel. Jack
Changing text layout in a UILabel - Specifically where it starts from I have this problem with one of my UILabels, I would like to have the text that it displays begin being drawn at the top left of the label rather than the middle left. Current screen: As you can see the word "Description" in the label appears in the ...
TITLE: Changing text layout in a UILabel - Specifically where it starts from QUESTION: I have this problem with one of my UILabels, I would like to have the text that it displays begin being drawn at the top left of the label rather than the middle left. Current screen: As you can see the word "Description" in the lab...
[ "iphone", "ios", "text", "interface-builder", "uilabel" ]
0
0
370
2
0
2011-06-05T01:54:12.367000
2011-06-06T23:52:43.557000
6,240,553
6,241,399
Using HTML Agility Pack to get text next to image?
I have this bit of html that I need to parse though x 3 1 x 1 x 1 As you can see there is an image and then a text like "x 3" next to it. What I want to do is go through each image, and record the text next to it. However, the text is outside the 'img' tag. I was wondering is there anyway of doing this using the HTML a...
The following code: HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.HtmlDocument(); doc.Load(yourHtml); foreach (HtmlNode node in doc.DocumentNode.SelectNodes("//img")) { Console.WriteLine(HtmlEntity.DeEntitize(node.NextSibling.InnerText).Trim()); } Will output: x 3 1 x 1 x 1 Note the HtmlEntity utility that ea...
Using HTML Agility Pack to get text next to image? I have this bit of html that I need to parse though x 3 1 x 1 x 1 As you can see there is an image and then a text like "x 3" next to it. What I want to do is go through each image, and record the text next to it. However, the text is outside the 'img' tag. I was wonde...
TITLE: Using HTML Agility Pack to get text next to image? QUESTION: I have this bit of html that I need to parse though x 3 1 x 1 x 1 As you can see there is an image and then a text like "x 3" next to it. What I want to do is go through each image, and record the text next to it. However, the text is outside the 'img...
[ "c#", "c#-4.0", "web-scraping", "html-agility-pack" ]
1
5
1,610
1
0
2011-06-05T01:55:15.973000
2011-06-05T06:38:16.633000
6,240,554
6,240,821
Can a view controller own a sheet?
I want to call a sheet from within a view controller (user clicks on a button and the sheet will be displayed). Can the sheet have a separate window controller (with outlets and actions) or does the view controller from which the sheet is called operate as the sheet's controller? I'm trying to determine how to display ...
A stock NSViewController controls a view; nothing more. You can make a custom subclass that owns the sheet, or you can make it own a window controller which owns the sheet. The choice is yours. Tried using a NSWindowController, but that didn't work. You should ask another question about that.
Can a view controller own a sheet? I want to call a sheet from within a view controller (user clicks on a button and the sheet will be displayed). Can the sheet have a separate window controller (with outlets and actions) or does the view controller from which the sheet is called operate as the sheet's controller? I'm ...
TITLE: Can a view controller own a sheet? QUESTION: I want to call a sheet from within a view controller (user clicks on a button and the sheet will be displayed). Can the sheet have a separate window controller (with outlets and actions) or does the view controller from which the sheet is called operate as the sheet'...
[ "macos", "cocoa", "controller", "cocoa-sheet" ]
1
1
529
1
0
2011-06-05T01:55:37.923000
2011-06-05T03:24:18.943000
6,240,568
6,240,911
T4MVC Doesn't work property with Url.Action()
This was my original code: @Url.Action("LoginYoutube", "Account", new { returnUrl = Request.QueryString["ReturnUrl"] }, "http") Which would generate: http://localhost:2543/Account/LoginYoutube With T4MVC I do: Url.Action(MVC.Account.LoginYoutube().AddRouteValue("returnUrl", Request.QueryString["ReturnUrl"])) and that g...
T4MVC is indeed missing something here, but it should be easy to add. Please try the following. In T4MVC.tt, change: public static string Action(this UrlHelper urlHelper, ActionResult result) { return urlHelper.RouteUrl(result.GetRouteValueDictionary()); } to public static string Action(this UrlHelper urlHelper, Action...
T4MVC Doesn't work property with Url.Action() This was my original code: @Url.Action("LoginYoutube", "Account", new { returnUrl = Request.QueryString["ReturnUrl"] }, "http") Which would generate: http://localhost:2543/Account/LoginYoutube With T4MVC I do: Url.Action(MVC.Account.LoginYoutube().AddRouteValue("returnUrl",...
TITLE: T4MVC Doesn't work property with Url.Action() QUESTION: This was my original code: @Url.Action("LoginYoutube", "Account", new { returnUrl = Request.QueryString["ReturnUrl"] }, "http") Which would generate: http://localhost:2543/Account/LoginYoutube With T4MVC I do: Url.Action(MVC.Account.LoginYoutube().AddRoute...
[ "c#", "asp.net-mvc", "t4mvc" ]
4
7
2,245
2
0
2011-06-05T01:59:28.320000
2011-06-05T03:53:56.447000
6,240,581
6,240,599
Keep MySQL schema in sync between computers
When developing, I can use SVN or Git to keep code in sync between machines. However, I have been unable to find something similar for MySQL. Does anyone know of anything? Update: I am trying to get the schema changes across machines. Getting the data to sync as well would be great but is not as important at the moment...
Data is not considered a part of your "application source". The schema (ie definition of the tables, indexes etc) should be considered part of your source, although many people do not bother when it comes to MySQL. If you need to keep data syncronised, you should look at replication scenarios. See this about replicatio...
Keep MySQL schema in sync between computers When developing, I can use SVN or Git to keep code in sync between machines. However, I have been unable to find something similar for MySQL. Does anyone know of anything? Update: I am trying to get the schema changes across machines. Getting the data to sync as well would be...
TITLE: Keep MySQL schema in sync between computers QUESTION: When developing, I can use SVN or Git to keep code in sync between machines. However, I have been unable to find something similar for MySQL. Does anyone know of anything? Update: I am trying to get the schema changes across machines. Getting the data to syn...
[ "mysql" ]
0
4
1,202
5
0
2011-06-05T02:02:26.380000
2011-06-05T02:08:02.087000
6,240,600
6,240,618
Are variables outside functions global variables?
It doesn't look like a global variable. However, does it have disadvantages like global stuff if it's outside the function?
Yes. They can be accessed from any location, including other scripts. They are slightly better as you have to used the global keyword to access them from within a function, which gives more clarity as to where they are coming from and what they do. The disadvantages of global variables apply, but this doesn't instantly...
Are variables outside functions global variables? It doesn't look like a global variable. However, does it have disadvantages like global stuff if it's outside the function?
TITLE: Are variables outside functions global variables? QUESTION: It doesn't look like a global variable. However, does it have disadvantages like global stuff if it's outside the function? ANSWER: Yes. They can be accessed from any location, including other scripts. They are slightly better as you have to used the ...
[ "php", "variables", "global-variables", "global" ]
9
8
10,254
6
0
2011-06-05T02:09:43.973000
2011-06-05T02:15:17.283000
6,240,607
6,240,637
Select only the UL child of a LI item
I want to do something similiar to a tree-view (really simpler).. This is my effort: (When I click the first "parent-item it goes ok and reveals his "son", but when I click the son, which is also a "parent-item", it toggles back.. So I want something like that closest() function but for childs instead of parents.. jque...
Use $(this).find('ul').first(); It finds all 'ul's below the context and the first() method limits it to just the first one
Select only the UL child of a LI item I want to do something similiar to a tree-view (really simpler).. This is my effort: (When I click the first "parent-item it goes ok and reveals his "son", but when I click the son, which is also a "parent-item", it toggles back.. So I want something like that closest() function bu...
TITLE: Select only the UL child of a LI item QUESTION: I want to do something similiar to a tree-view (really simpler).. This is my effort: (When I click the first "parent-item it goes ok and reveals his "son", but when I click the son, which is also a "parent-item", it toggles back.. So I want something like that clo...
[ "jquery", "html", "jquery-selectors" ]
1
4
10,800
3
0
2011-06-05T02:12:27.220000
2011-06-05T02:21:47.700000
6,240,608
6,242,963
Setting DrawMode in ListBox removes horizontal scroll bar
I set the DrawMode in my listbox control to OwnerDrawFixed so that I can color some items. When an item is too long to fit in the horizontal space of the list box no horizontal scoll appears. How can I make the scrollbar appear?
you should set HorizontalExtent property of listbox in OwnerDrawFixed mode listBox1.HorizontalExtent = xx; //xx can be maximum size list box item fills To determine the value that HorizontalExtent should be set to use the following method on the the strings in your list box and get the Width property: TextRenderer.Meas...
Setting DrawMode in ListBox removes horizontal scroll bar I set the DrawMode in my listbox control to OwnerDrawFixed so that I can color some items. When an item is too long to fit in the horizontal space of the list box no horizontal scoll appears. How can I make the scrollbar appear?
TITLE: Setting DrawMode in ListBox removes horizontal scroll bar QUESTION: I set the DrawMode in my listbox control to OwnerDrawFixed so that I can color some items. When an item is too long to fit in the horizontal space of the list box no horizontal scoll appears. How can I make the scrollbar appear? ANSWER: you sh...
[ "c#", "winforms", "listbox", "scroll", "scrollbar" ]
3
5
3,647
2
0
2011-06-05T02:12:39.140000
2011-06-05T12:42:56.973000
6,240,628
6,240,650
Rails routing \ controller issue
routes.rb match '/:permalink' => 'Pub#show_page' in pub_controller: def show_page @page = Page.find_by_permalink(params[:permalink]) if @page.nil? render:status => 404 end end in show_page.html.erb: <%= @page.title %> <%= @page.content %> Then I go to localhost:3000/non-existing-permalink What is going on here? I al...
render:status => 404 just renders the usual page with a status code of 404. E.g. it's rendering show_page.html.erb with an Apache code of 404 (which, of course, is invisible to the user). You want to redirect to a 404 page. See How to redirect to a 404 in Rails?
Rails routing \ controller issue routes.rb match '/:permalink' => 'Pub#show_page' in pub_controller: def show_page @page = Page.find_by_permalink(params[:permalink]) if @page.nil? render:status => 404 end end in show_page.html.erb: <%= @page.title %> <%= @page.content %> Then I go to localhost:3000/non-existing-perm...
TITLE: Rails routing \ controller issue QUESTION: routes.rb match '/:permalink' => 'Pub#show_page' in pub_controller: def show_page @page = Page.find_by_permalink(params[:permalink]) if @page.nil? render:status => 404 end end in show_page.html.erb: <%= @page.title %> <%= @page.content %> Then I go to localhost:3000...
[ "ruby-on-rails", "model-view-controller", "routes" ]
0
1
97
1
0
2011-06-05T02:19:21.087000
2011-06-05T02:26:59.400000
6,240,631
6,240,692
Cufon Not Showing
I cannot understand why my Cufon is not working, All.js files load fine: Company Name Company Home
Try with changing: to just: It works for me after such change (using Vegur.font.js font, tested on Opera 11 and Google Chrome 11). Edit: Works as well with Springsteel_Lig_300.font.js font. I just donloaded Springsteel Light font (springsteel-lig.otf) and used that site to generate in js format.
Cufon Not Showing I cannot understand why my Cufon is not working, All.js files load fine: Company Name Company Home
TITLE: Cufon Not Showing QUESTION: I cannot understand why my Cufon is not working, All.js files load fine: Company Name Company Home ANSWER: Try with changing: to just: It works for me after such change (using Vegur.font.js font, tested on Opera 11 and Google Chrome 11). Edit: Works as well with Springsteel_Lig_300....
[ "javascript", "html", "cufon" ]
1
1
1,219
1
0
2011-06-05T02:19:54.160000
2011-06-05T02:43:11.847000
6,240,636
6,240,677
is there a way to just respawn php children processes without restarting php itself?
I'm running php-fpm and I'd like to shutdown and respawn php children without restarting php itself.
Actually, there is by using pcntl functions, pcntl_fork() in particular would be your friend for this.. You can find many code examples on this page. Trivial example: $pid = pcntl_fork(); if($pid) { // parent process runs what is here print "parent\n"; } else { // child process runs what is here print "child\n"; } //...
is there a way to just respawn php children processes without restarting php itself? I'm running php-fpm and I'd like to shutdown and respawn php children without restarting php itself.
TITLE: is there a way to just respawn php children processes without restarting php itself? QUESTION: I'm running php-fpm and I'd like to shutdown and respawn php children without restarting php itself. ANSWER: Actually, there is by using pcntl functions, pcntl_fork() in particular would be your friend for this.. You...
[ "php", "children" ]
1
2
143
1
0
2011-06-05T02:21:37.437000
2011-06-05T02:37:48.920000
6,240,644
6,240,730
Codeigniter and jQuery for dynamical inputs
This is my first question, i would be very pleased if you can help me. I have to catch the values of a set of dynamic inputs, i am generating the inputs with jQuery. I dont know if it’s a good solution to use the same name for all with brackets at the end like this: Or just use a counter at the end of the name, like th...
Your best bet is definitely to use an array, as you are doing in your first example. To get all the results, something like this will work: $names = $this->input->post('nombre_contacto'); $emails = $this->input->post('mail_contacto'); Both variables are now arrays, their values are whatever the user input is, and their...
Codeigniter and jQuery for dynamical inputs This is my first question, i would be very pleased if you can help me. I have to catch the values of a set of dynamic inputs, i am generating the inputs with jQuery. I dont know if it’s a good solution to use the same name for all with brackets at the end like this: Or just u...
TITLE: Codeigniter and jQuery for dynamical inputs QUESTION: This is my first question, i would be very pleased if you can help me. I have to catch the values of a set of dynamic inputs, i am generating the inputs with jQuery. I dont know if it’s a good solution to use the same name for all with brackets at the end li...
[ "jquery", "codeigniter" ]
1
0
216
1
0
2011-06-05T02:25:52.460000
2011-06-05T02:56:18.050000
6,240,648
6,250,742
How to link a Python project to a WSGI file?
I want to link my Python project to a wsgi file. I am using mod_wsgi. I would like my Python project to be located in /var/www/myProject/start.py. I've configured Apache as follows: ServerName www.example.me ServerAlias example.me ServerAdmin example@gmail.com DocumentRoot /usr/local/www/documents LogLevel warn Alias ...
Replace final argument to WSGIScriptAlias with '/var/www/myProject/start.py'. Change reference in Directory directive to '/var/www/myProject'. In other words, just set the configuration to point to the correct location in the first place.
How to link a Python project to a WSGI file? I want to link my Python project to a wsgi file. I am using mod_wsgi. I would like my Python project to be located in /var/www/myProject/start.py. I've configured Apache as follows: ServerName www.example.me ServerAlias example.me ServerAdmin example@gmail.com DocumentRoot /...
TITLE: How to link a Python project to a WSGI file? QUESTION: I want to link my Python project to a wsgi file. I am using mod_wsgi. I would like my Python project to be located in /var/www/myProject/start.py. I've configured Apache as follows: ServerName www.example.me ServerAlias example.me ServerAdmin example@gmail....
[ "python", "apache", "mod-wsgi", "web.py" ]
1
1
3,228
2
0
2011-06-05T02:26:42.630000
2011-06-06T10:32:05.757000
6,240,660
6,240,864
How to read gmon.out?
How do I read gmon.out in Windows? Windows can't so much as open the file, so gmon.out options doesn't quite work in the command-line window.
gprof is the tool that reads a gmon.out file and displays information from it.
How to read gmon.out? How do I read gmon.out in Windows? Windows can't so much as open the file, so gmon.out options doesn't quite work in the command-line window.
TITLE: How to read gmon.out? QUESTION: How do I read gmon.out in Windows? Windows can't so much as open the file, so gmon.out options doesn't quite work in the command-line window. ANSWER: gprof is the tool that reads a gmon.out file and displays information from it.
[ "c++", "gcc", "windows-7", "profile" ]
14
21
36,616
1
0
2011-06-05T02:30:37.823000
2011-06-05T03:40:27.010000
6,240,661
6,240,678
Emacs mouse support over terminal ssh
In my.vimrc file, I have this line: set mouse=a This enables the mouse to work with vim. You can move the point around by clicking, and it responds to the scroll wheel. It also works fine even in a vim instance accessed over a standard terminal emulator using SSH. Is there a way to enable the same functionality in Emac...
Does xterm-mouse-mode do what you want? I found it by searching "emacs 'set mouse=a'"
Emacs mouse support over terminal ssh In my.vimrc file, I have this line: set mouse=a This enables the mouse to work with vim. You can move the point around by clicking, and it responds to the scroll wheel. It also works fine even in a vim instance accessed over a standard terminal emulator using SSH. Is there a way to...
TITLE: Emacs mouse support over terminal ssh QUESTION: In my.vimrc file, I have this line: set mouse=a This enables the mouse to work with vim. You can move the point around by clicking, and it responds to the scroll wheel. It also works fine even in a vim instance accessed over a standard terminal emulator using SSH....
[ "emacs" ]
8
10
2,094
1
0
2011-06-05T02:31:10.963000
2011-06-05T02:38:49.650000
6,240,667
6,240,755
css3 border-radius - inside is square on Chrome + Safari?
It is easiest to describe this problem with pictures. How it is meant to look (works in Firefox): firefox In Chrome and Safari the insides of the border are square for some reason: chrome Here is my CSS:.header { width: 850px; margin-left: auto; margin-right: auto; background-color: #F7F7F7; -moz-border-radius: 40px; -...
If you remove the alpha from the border, it works. Since you probably don't want to do that, you may be able to use two nested elements. Example here.
css3 border-radius - inside is square on Chrome + Safari? It is easiest to describe this problem with pictures. How it is meant to look (works in Firefox): firefox In Chrome and Safari the insides of the border are square for some reason: chrome Here is my CSS:.header { width: 850px; margin-left: auto; margin-right: au...
TITLE: css3 border-radius - inside is square on Chrome + Safari? QUESTION: It is easiest to describe this problem with pictures. How it is meant to look (works in Firefox): firefox In Chrome and Safari the insides of the border are square for some reason: chrome Here is my CSS:.header { width: 850px; margin-left: auto...
[ "html", "border", "css" ]
1
1
5,692
5
0
2011-06-05T02:32:59.197000
2011-06-05T03:03:18.337000
6,240,676
6,240,708
Using the closure scope to keep the last value
I have the following: $('th').click(function() { var $th = $(this);... }); Using the closure scope, I want to say: var $th; $('th').click(function() { if ($th!== $(this)) { $th = $(this);... } }); Note: This code is just prior to, so I won't need $(function() {});
You should check whether the underlying DOM elements are equal: if ($th[0]!== this) { (You could also store this itself without calling $ )
Using the closure scope to keep the last value I have the following: $('th').click(function() { var $th = $(this);... }); Using the closure scope, I want to say: var $th; $('th').click(function() { if ($th!== $(this)) { $th = $(this);... } }); Note: This code is just prior to, so I won't need $(function() {});
TITLE: Using the closure scope to keep the last value QUESTION: I have the following: $('th').click(function() { var $th = $(this);... }); Using the closure scope, I want to say: var $th; $('th').click(function() { if ($th!== $(this)) { $th = $(this);... } }); Note: This code is just prior to, so I won't need $(functi...
[ "javascript", "jquery" ]
1
3
160
1
0
2011-06-05T02:37:41.507000
2011-06-05T02:49:54.063000
6,240,680
6,247,411
Flex text inserted into TextArea causes application to hang
I am attempting to insert text from a database into a custom TextArea component, using the following: var front:CaptionTextArea = myFlashcardFrontsides[adjIndex] as CaptionTextArea; var back:CaptionTextArea = myFlashcardBacksides[adjIndex] as CaptionTextArea; var passage:CaptionTextInput = myVersePassages[adjIndex] as ...
I resolved the issue, and all I had to do was change my TextArea from a Spark TextArea to an MX TextArea: // import spark.components.TextArea; DON'T USE: SPARK TEXT AREA CAUSES A BUG WHEN PROGRAMATICALLY INSERTING LONGER TEXT STRINGS import mx.controls.TextArea; public class CaptionTextArea extends TextArea It seems l...
Flex text inserted into TextArea causes application to hang I am attempting to insert text from a database into a custom TextArea component, using the following: var front:CaptionTextArea = myFlashcardFrontsides[adjIndex] as CaptionTextArea; var back:CaptionTextArea = myFlashcardBacksides[adjIndex] as CaptionTextArea; ...
TITLE: Flex text inserted into TextArea causes application to hang QUESTION: I am attempting to insert text from a database into a custom TextArea component, using the following: var front:CaptionTextArea = myFlashcardFrontsides[adjIndex] as CaptionTextArea; var back:CaptionTextArea = myFlashcardBacksides[adjIndex] as...
[ "apache-flex", "actionscript", "textarea" ]
1
0
791
2
0
2011-06-05T02:39:07.670000
2011-06-06T02:53:15.827000