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,187,677
6,192,728
IIS7 The Application Warm-Up Module Official Release?
I was using the IIS7 The Application Warm-Up Module Beta, which has been removed from the download site. Please could someone tell me where I could find the official release of this module. Can't find it anywhere - thanks! Download was available here: http://forums.iis.net/t/1176740.aspx
As per the message in the link you included, the Beta has been removed due to a change in direction of the project. There is no official release at this time.
IIS7 The Application Warm-Up Module Official Release? I was using the IIS7 The Application Warm-Up Module Beta, which has been removed from the download site. Please could someone tell me where I could find the official release of this module. Can't find it anywhere - thanks! Download was available here: http://forums....
TITLE: IIS7 The Application Warm-Up Module Official Release? QUESTION: I was using the IIS7 The Application Warm-Up Module Beta, which has been removed from the download site. Please could someone tell me where I could find the official release of this module. Can't find it anywhere - thanks! Download was available he...
[ "iis-7" ]
4
2
2,927
1
0
2011-05-31T12:37:12.783000
2011-05-31T19:48:10.220000
6,187,678
6,187,719
Malicious object injection with xstream
Can I safely use XStream to process XML coming from outside of my system? What's the best practice when dealing with "potentially malicious XML" using xstream? Let's say, I have a class somewhere in my code like this: package hazard; class Dangerous { public Dangerous() { AtomicBomb.getInstance().nuke(); } } A maliciou...
Never ever allow xstream (or any other serialization framework) to marshal anything but clean, pure javabeans (getters and setters). UPDATE: Your mentioned theory about using a Mapper should work, although it will require some amount of scaffolding and custom config being built by you. Another way is to use the feature...
Malicious object injection with xstream Can I safely use XStream to process XML coming from outside of my system? What's the best practice when dealing with "potentially malicious XML" using xstream? Let's say, I have a class somewhere in my code like this: package hazard; class Dangerous { public Dangerous() { AtomicB...
TITLE: Malicious object injection with xstream QUESTION: Can I safely use XStream to process XML coming from outside of my system? What's the best practice when dealing with "potentially malicious XML" using xstream? Let's say, I have a class somewhere in my code like this: package hazard; class Dangerous { public Dan...
[ "java", "security", "xstream" ]
1
4
972
2
0
2011-05-31T12:37:23.843000
2011-05-31T12:41:13.653000
6,187,679
6,187,768
How to create haskell permutation
What i want to do is create a function that given a certain length creates all possible combinations/permutations of True/False ex. getPerm 2 shall return [True,True,True,False,False,True,False,False] getTrue 0 = [] getTrue size = (True:(getTrue (size-1)))++(True:(getFalse (size-1))) getFalse 0 = [] getFalse size =(Fal...
getPerm n = concat $ replicateM n [True, False] While it might qualify as a "weird thing", it isn't too hard. [True, False] represents nondeterministic choice in the list monad. replicateM makes a nondeterministic list of n repetitions of these choices. Since you wanted them all in one list we concatenate to get the fi...
How to create haskell permutation What i want to do is create a function that given a certain length creates all possible combinations/permutations of True/False ex. getPerm 2 shall return [True,True,True,False,False,True,False,False] getTrue 0 = [] getTrue size = (True:(getTrue (size-1)))++(True:(getFalse (size-1))) g...
TITLE: How to create haskell permutation QUESTION: What i want to do is create a function that given a certain length creates all possible combinations/permutations of True/False ex. getPerm 2 shall return [True,True,True,False,False,True,False,False] getTrue 0 = [] getTrue size = (True:(getTrue (size-1)))++(True:(get...
[ "function", "haskell", "boolean", "permutation" ]
3
5
2,759
3
0
2011-05-31T12:37:30.270000
2011-05-31T12:46:04.540000
6,187,699
6,188,017
How to convert integer value to array of four bytes in python
I need to send a message of bytes in Python and I need to convert an unsigned integer number to a byte array. How do you convert an integer value to an array of four bytes in Python? Like in C: uint32_t number=100; array[0]=(number >>24) & 0xff; array[1]=(number >>16) & 0xff; array[2]=(number >>8) & 0xff; array[3]=numb...
Sven has you answer. However, byte shifting numbers (as in your question) is also possible in Python: >>> [hex(0x12345678 >> i & 0xff) for i in (24,16,8,0)] ['0x12', '0x34', '0x56', '0x78']
How to convert integer value to array of four bytes in python I need to send a message of bytes in Python and I need to convert an unsigned integer number to a byte array. How do you convert an integer value to an array of four bytes in Python? Like in C: uint32_t number=100; array[0]=(number >>24) & 0xff; array[1]=(nu...
TITLE: How to convert integer value to array of four bytes in python QUESTION: I need to send a message of bytes in Python and I need to convert an unsigned integer number to a byte array. How do you convert an integer value to an array of four bytes in Python? Like in C: uint32_t number=100; array[0]=(number >>24) & ...
[ "python" ]
41
18
86,268
7
0
2011-05-31T12:39:03.190000
2011-05-31T13:05:22.847000
6,187,701
6,189,438
Is There a way to save files in the iPhone flash memory with phonegap?
my question is quite simple: When i save files with phonegap API, those file are saved in the HTML 5 storage DB ( wrapped in Phonegap ) or in the iPhone memory? If you have understood, i prefer the second option, because there isn't the limit of 5 MB....
I think you're talking about Local Storage, which does have a 5MB limit. But keep in mind that Local Storage is more for key/value pairs. While 5MB is not a lot for, say, multimedia files, it's a fair amount for just data. If what you're after is the saving of files to the device, check out PhoneGap's documentation on ...
Is There a way to save files in the iPhone flash memory with phonegap? my question is quite simple: When i save files with phonegap API, those file are saved in the HTML 5 storage DB ( wrapped in Phonegap ) or in the iPhone memory? If you have understood, i prefer the second option, because there isn't the limit of 5 M...
TITLE: Is There a way to save files in the iPhone flash memory with phonegap? QUESTION: my question is quite simple: When i save files with phonegap API, those file are saved in the HTML 5 storage DB ( wrapped in Phonegap ) or in the iPhone memory? If you have understood, i prefer the second option, because there isn'...
[ "iphone", "cordova", "web-applications" ]
0
2
1,106
3
0
2011-05-31T12:39:20.067000
2011-05-31T14:51:24.193000
6,187,717
6,187,756
jquery hover on table row with .live help
I have a table and I create rows on the fly with: $('#AjaxResultTable > tbody:last').append(' + ' + id + name + suburb + state + zip + ' ').hide().fadeIn(200); I want to change background color on rows when I hover over them and change back when I'm not. I tried with $('#AjaxResultTable tr').hover(function () { $(this)...
I'd make a simple event handler that toggles a class. JS $('#AjaxResultTable').delegate('tr', 'mouseenter mouseleave', function() { $(this).toggleClass('hover'); }); CSS.hover { background-color: #F5F5F5; } EDIT: Also in your example, the property should be called backgroundColor (instead of background-color ) EDIT 2:....
jquery hover on table row with .live help I have a table and I create rows on the fly with: $('#AjaxResultTable > tbody:last').append(' + ' + id + name + suburb + state + zip + ' ').hide().fadeIn(200); I want to change background color on rows when I hover over them and change back when I'm not. I tried with $('#AjaxRe...
TITLE: jquery hover on table row with .live help QUESTION: I have a table and I create rows on the fly with: $('#AjaxResultTable > tbody:last').append(' + ' + id + name + suburb + state + zip + ' ').hide().fadeIn(200); I want to change background color on rows when I hover over them and change back when I'm not. I tri...
[ "jquery", "css" ]
0
2
1,776
5
0
2011-05-31T12:40:51.097000
2011-05-31T12:44:55.193000
6,187,724
6,187,826
Force GSON to use specific constructor
public class UserAction { private final UUID uuid; private String userId; /* more fields, setters and getters here */ public UserAction(){ this.uuid = UUID.fromString(new com.eaio.uuid.UUID().toString()); } public UserAction(UUID uuid){ this.uuid = uuid; } @Override public boolean equals(Object obj) { if (obj == null...
You could implement a custom JsonDeserializer and register it with GSON. class UserActionDeserializer implements JsonDeserializer { public UserAction deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { return new UserAction(UUID.fromString(json.getAsString()); } ...
Force GSON to use specific constructor public class UserAction { private final UUID uuid; private String userId; /* more fields, setters and getters here */ public UserAction(){ this.uuid = UUID.fromString(new com.eaio.uuid.UUID().toString()); } public UserAction(UUID uuid){ this.uuid = uuid; } @Override public boole...
TITLE: Force GSON to use specific constructor QUESTION: public class UserAction { private final UUID uuid; private String userId; /* more fields, setters and getters here */ public UserAction(){ this.uuid = UUID.fromString(new com.eaio.uuid.UUID().toString()); } public UserAction(UUID uuid){ this.uuid = uuid; } @Ove...
[ "java", "constructor", "gson", "deserialization" ]
25
26
20,896
3
0
2011-05-31T12:41:52.237000
2011-05-31T12:50:30.753000
6,187,728
6,187,888
Custom C# Form Design
I'm kind of stuck on this one, I know it can be done but unsure the steps needed. I want to create a fully custom User Interface design for an application I'm having to create. I can change the form background and all that but this is a bit more complex. An example image is shown below of the kind of change I'm referri...
Since you can't use WPF (why?!), you'll need to create custom classes for all your controls, inheriting and overriding OnPaint. This will be a hard job done all with C# code. Here is a tutorial showing many steps to create custom UI for WinForms.
Custom C# Form Design I'm kind of stuck on this one, I know it can be done but unsure the steps needed. I want to create a fully custom User Interface design for an application I'm having to create. I can change the form background and all that but this is a bit more complex. An example image is shown below of the kind...
TITLE: Custom C# Form Design QUESTION: I'm kind of stuck on this one, I know it can be done but unsure the steps needed. I want to create a fully custom User Interface design for an application I'm having to create. I can change the form background and all that but this is a bit more complex. An example image is shown...
[ "c#", "winforms", "user-interface" ]
5
2
18,191
3
0
2011-05-31T12:42:19.190000
2011-05-31T12:55:50.253000
6,187,731
6,195,157
zend saving image from url
i am extracting all img urls from an array and getting image urls from external sites... how do i go about saving these images? i tried using $upload = new Zend_File_Transfer_Adapter_Http(); $upload->setDestination("img/"); # Returns the file name for 'doc_path' named file element $name = $upload->getFileName('http://...
I think that you cannot do it using Zend_File_Transfer_Adapter_Http as this works only with uploaded files. However, you could use Zend_Http_Client for this. For example: $c = new Zend_Http_Client(); $c->setUri('http://zendguru.files.wordpress.com/2009/04/ajax-form1.jpg'); $result = $c->request('GET'); $img = imagecrea...
zend saving image from url i am extracting all img urls from an array and getting image urls from external sites... how do i go about saving these images? i tried using $upload = new Zend_File_Transfer_Adapter_Http(); $upload->setDestination("img/"); # Returns the file name for 'doc_path' named file element $name = $u...
TITLE: zend saving image from url QUESTION: i am extracting all img urls from an array and getting image urls from external sites... how do i go about saving these images? i tried using $upload = new Zend_File_Transfer_Adapter_Http(); $upload->setDestination("img/"); # Returns the file name for 'doc_path' named file ...
[ "php", "zend-framework" ]
3
4
2,701
2
0
2011-05-31T12:42:31.867000
2011-06-01T00:55:37.107000
6,187,738
6,187,777
Ruby, Generate a random hex color (only light colors)
I know this is possible duplicated question. Ruby, Generate a random hex color My question is slightly different. I need to know, how to generate the random hex light colors only, not the dark.
In this thread colour lumincance is described with a formula of (0.2126*r) + (0.7152*g) + (0.0722*b) The same formula for luminance is given in wikipedia (and it is taken from this publication ). It reflects the human perception, with green being the most "intensive" and blue the least. Therefore, you can select r, g, ...
Ruby, Generate a random hex color (only light colors) I know this is possible duplicated question. Ruby, Generate a random hex color My question is slightly different. I need to know, how to generate the random hex light colors only, not the dark.
TITLE: Ruby, Generate a random hex color (only light colors) QUESTION: I know this is possible duplicated question. Ruby, Generate a random hex color My question is slightly different. I need to know, how to generate the random hex light colors only, not the dark. ANSWER: In this thread colour lumincance is described...
[ "ruby", "random", "colors" ]
4
7
5,248
6
0
2011-05-31T12:43:12.750000
2011-05-31T12:46:44.460000
6,187,742
6,187,770
Getting total value from each field?
How do I get the Total value of Yes, No, Other fields of each username? I like to add Total field. SELECT Username, SUM(CASE WHEN type = 'Yes' THEN 1 ELSE NULL END) as Yes, SUM(CASE WHEN type = 'No' THEN 1 ELSE NULL END) as No, SUM(CASE WHEN type = '' THEN 1 ELSE NULL END) as Other //How to get total of Yes/No/Other FR...
use 0 instead of NULL, add the missing group by and use COUNT(*) to get the total of each group and order the result: SELECT Username, SUM(CASE WHEN type = 'Yes' THEN 1 ELSE 0 END) as Yes, SUM(CASE WHEN type = 'No' THEN 1 ELSE 0 END) as No, SUM(CASE WHEN type = '' THEN 1 ELSE 0 END) as Other, COUNT(*) as TOTAL FROM tab...
Getting total value from each field? How do I get the Total value of Yes, No, Other fields of each username? I like to add Total field. SELECT Username, SUM(CASE WHEN type = 'Yes' THEN 1 ELSE NULL END) as Yes, SUM(CASE WHEN type = 'No' THEN 1 ELSE NULL END) as No, SUM(CASE WHEN type = '' THEN 1 ELSE NULL END) as Other ...
TITLE: Getting total value from each field? QUESTION: How do I get the Total value of Yes, No, Other fields of each username? I like to add Total field. SELECT Username, SUM(CASE WHEN type = 'Yes' THEN 1 ELSE NULL END) as Yes, SUM(CASE WHEN type = 'No' THEN 1 ELSE NULL END) as No, SUM(CASE WHEN type = '' THEN 1 ELSE N...
[ "mysql", "sql", "database" ]
1
2
194
3
0
2011-05-31T12:43:35.447000
2011-05-31T12:46:12.577000
6,187,743
6,187,824
Parse XML received from a GET request
As a part of a school project, i am making a call of the school's api. Method: GET Response Format: Xml Now i use curl to make the web request. $ch=curl_init(); curl_setopt($ch,CURLOPT_URL,$url); curl_setopt($ch,CURLOPT_RETURNTRANSFER,1); $data=curl_exec($ch); curl_close($ch); Now how do i parse the xml output to ge...
This depends on the exact nature of the content and, moreover, its structure. The basics are to use DOMDocument (or, alternatively, simplexml, which I dislike as an API) to parse the document, then to use DOM traversal or XPath to find the content you want. An example might look like this: $dom = new DOMDocument; $dom-...
Parse XML received from a GET request As a part of a school project, i am making a call of the school's api. Method: GET Response Format: Xml Now i use curl to make the web request. $ch=curl_init(); curl_setopt($ch,CURLOPT_URL,$url); curl_setopt($ch,CURLOPT_RETURNTRANSFER,1); $data=curl_exec($ch); curl_close($ch); N...
TITLE: Parse XML received from a GET request QUESTION: As a part of a school project, i am making a call of the school's api. Method: GET Response Format: Xml Now i use curl to make the web request. $ch=curl_init(); curl_setopt($ch,CURLOPT_URL,$url); curl_setopt($ch,CURLOPT_RETURNTRANSFER,1); $data=curl_exec($ch); ...
[ "php", "xml", "dom", "curl" ]
1
2
1,611
4
0
2011-05-31T12:43:40.910000
2011-05-31T12:50:22.987000
6,187,748
6,187,881
Default sort column in rich:datatable
I have rich:dataTable with multiple sortable columns....... etc. Sorting works fine. However, when page is loaded, table is always sorted by 1st column. How can I set "default" sorting column? (for example, the one with user.sn) Edit: I wanted it sorted by sn first, uid second.
I suppose you will have to sort the underlying list. By default the table will be ordered like the list is that you pass as value.
Default sort column in rich:datatable I have rich:dataTable with multiple sortable columns....... etc. Sorting works fine. However, when page is loaded, table is always sorted by 1st column. How can I set "default" sorting column? (for example, the one with user.sn) Edit: I wanted it sorted by sn first, uid second.
TITLE: Default sort column in rich:datatable QUESTION: I have rich:dataTable with multiple sortable columns....... etc. Sorting works fine. However, when page is loaded, table is always sorted by 1st column. How can I set "default" sorting column? (for example, the one with user.sn) Edit: I wanted it sorted by sn firs...
[ "java", "jsf", "sorting", "datatable", "richfaces" ]
5
0
10,800
3
0
2011-05-31T12:43:59.720000
2011-05-31T12:55:14.417000
6,187,765
6,187,868
vb script: Trying to open a command prompt, navigate to a directory and run a command
I need to write a script that looks in a directory, finds the latest.zip file (there are.zip and.log in there) then opens a command prompt in a different directory and runs the following command: loaddb.bat -Dlc.file="C:\Program Files\XyEnterprise\SDL LiveContent\data_old\export\ " -Dlc.pswd= RESTORE We can not install...
You need to quote that path as it contains spaces; objShell.Run "%comspec% /k c: & cd ""../../../Program Files\XyEnterprise\SDL LiveContent\data\export"""
vb script: Trying to open a command prompt, navigate to a directory and run a command I need to write a script that looks in a directory, finds the latest.zip file (there are.zip and.log in there) then opens a command prompt in a different directory and runs the following command: loaddb.bat -Dlc.file="C:\Program Files...
TITLE: vb script: Trying to open a command prompt, navigate to a directory and run a command QUESTION: I need to write a script that looks in a directory, finds the latest.zip file (there are.zip and.log in there) then opens a command prompt in a different directory and runs the following command: loaddb.bat -Dlc.file...
[ "vbscript", "dos" ]
0
2
5,456
1
0
2011-05-31T12:45:59.637000
2011-05-31T12:54:19.863000
6,187,788
6,187,941
Creating advanced http entity with Android
I need to create a httpentiy like this: "project" => {"name" => "lorem", "description" => "ipsum"} for my RoR webservice my code: private String postData(String url, String user, String password, ArrayList nameValuePairs) throws ClientProtocolException, IOException { HttpPost httppost = new HttpPost(url); HttpClient ht...
Hope this solves your problem... List nameValuePairs = new ArrayList (); nameValuePairs.add(new BasicNameValuePair("project[name]", "Dinash")); nameValuePairs.add(new BasicNameValuePair("project[description]", "dina"));
Creating advanced http entity with Android I need to create a httpentiy like this: "project" => {"name" => "lorem", "description" => "ipsum"} for my RoR webservice my code: private String postData(String url, String user, String password, ArrayList nameValuePairs) throws ClientProtocolException, IOException { HttpPost ...
TITLE: Creating advanced http entity with Android QUESTION: I need to create a httpentiy like this: "project" => {"name" => "lorem", "description" => "ipsum"} for my RoR webservice my code: private String postData(String url, String user, String password, ArrayList nameValuePairs) throws ClientProtocolException, IOExc...
[ "android", "http" ]
2
2
1,133
1
0
2011-05-31T12:47:16.737000
2011-05-31T13:00:14.970000
6,187,807
6,187,925
Guidelines about handling sql exceptions in dot net application
consider there is n-tier architecture in asp.net 3.5 application with c# language and Database in the sql server 2008. Suppose we called the stored procedure exist in database, in our data access layer. But while execution of the stored procedure,It gets exception. (which may facilitate to throw out in stored procedure...
You should be validating and/or sanitising all the data that has been input before it reaches the database, so unless the DB is not present or there is a bug in a SP you shouldn't really get SQL exceptions. From my experience you would catch the SQL Exception log it, wrap it in an ApplicationException and return a user...
Guidelines about handling sql exceptions in dot net application consider there is n-tier architecture in asp.net 3.5 application with c# language and Database in the sql server 2008. Suppose we called the stored procedure exist in database, in our data access layer. But while execution of the stored procedure,It gets e...
TITLE: Guidelines about handling sql exceptions in dot net application QUESTION: consider there is n-tier architecture in asp.net 3.5 application with c# language and Database in the sql server 2008. Suppose we called the stored procedure exist in database, in our data access layer. But while execution of the stored p...
[ "asp.net", "stored-procedures", "sqlexception" ]
0
1
592
1
0
2011-05-31T12:48:40.913000
2011-05-31T12:59:11.710000
6,187,821
6,188,384
ASP.NET how to pass Session variable in ListView
I'm trying to pass a Session("sessionVar") on to ListView INSERT. Is there any way I can achieve this. I tried this and dosns't seem to work: InsertCommand="INSERT INTO [EmployeeTest] ([FName], [LName], [samAccount]) VALUES (@Fname, @LName,@samAccount) On Page_Load: Session["samAccount"]=getSamAccountFromActiveDirector...
Shouldn't you have EmployeeID as the db field name, not samAccount? InsertCommand="INSERT INTO [EmployeeTest] ([FName], [LName], [EmployeeID]) VALUES (@Fname, @LName,@samAccount)
ASP.NET how to pass Session variable in ListView I'm trying to pass a Session("sessionVar") on to ListView INSERT. Is there any way I can achieve this. I tried this and dosns't seem to work: InsertCommand="INSERT INTO [EmployeeTest] ([FName], [LName], [samAccount]) VALUES (@Fname, @LName,@samAccount) On Page_Load: Sess...
TITLE: ASP.NET how to pass Session variable in ListView QUESTION: I'm trying to pass a Session("sessionVar") on to ListView INSERT. Is there any way I can achieve this. I tried this and dosns't seem to work: InsertCommand="INSERT INTO [EmployeeTest] ([FName], [LName], [samAccount]) VALUES (@Fname, @LName,@samAccount) ...
[ "asp.net", "session" ]
1
0
1,247
2
0
2011-05-31T12:49:50.553000
2011-05-31T13:33:41.407000
6,187,825
6,187,901
QProcess on the loose
I have created two programs A and B. B is designed to be as a 32-bits QProcess started within a 64-bits A. These programs communicate nicely via stdin, stdout and QSharedMemory. A:A() { QProcess *p = new QProcess(this); p->start("B.exe"); } A:~A() { p->deleteLater(); } Now, if A is closed B will also be shut down. Howe...
Try to close() (or kill() ) the other process from your DTOR and do a raw delete p afterwards. I had a similar issue when using a QextSerialPort object which, too, tended to stay around as a ghost when deleted with deleteLater(), however promptly packed up and left when immediately deleted.
QProcess on the loose I have created two programs A and B. B is designed to be as a 32-bits QProcess started within a 64-bits A. These programs communicate nicely via stdin, stdout and QSharedMemory. A:A() { QProcess *p = new QProcess(this); p->start("B.exe"); } A:~A() { p->deleteLater(); } Now, if A is closed B will a...
TITLE: QProcess on the loose QUESTION: I have created two programs A and B. B is designed to be as a 32-bits QProcess started within a 64-bits A. These programs communicate nicely via stdin, stdout and QSharedMemory. A:A() { QProcess *p = new QProcess(this); p->start("B.exe"); } A:~A() { p->deleteLater(); } Now, if A ...
[ "qt", "qprocess", "destruction" ]
1
1
579
1
0
2011-05-31T12:50:29.303000
2011-05-31T12:57:08.183000
6,187,828
6,187,887
How can I draw a horizontal line and center it?
Here's what I have so far. When the phone is vertical: When the phone is horizontal: Here's my XAML markup: I'd like a line that is the same width as it currently is, but centered. But also when the phone is horizontal, the line should be a bit bigger to address the wider space available to it. Is this possible?
You can have that kind of sizing by using margin to size your content instead of positions. If that's not possible with a Line (I haven't really checked), you might try to use a 1 pixel high (or 4 rather) Rectangle. EDIT: with a code snippet:
How can I draw a horizontal line and center it? Here's what I have so far. When the phone is vertical: When the phone is horizontal: Here's my XAML markup: I'd like a line that is the same width as it currently is, but centered. But also when the phone is horizontal, the line should be a bit bigger to address the wider...
TITLE: How can I draw a horizontal line and center it? QUESTION: Here's what I have so far. When the phone is vertical: When the phone is horizontal: Here's my XAML markup: I'd like a line that is the same width as it currently is, but centered. But also when the phone is horizontal, the line should be a bit bigger to...
[ ".net", "xaml", "windows-phone-7", "line" ]
7
12
9,556
3
0
2011-05-31T12:50:33.890000
2011-05-31T12:55:46.993000
6,187,830
6,187,957
Error when compiling cpp file
Possible Duplicate: C++: malloc: error: invalid conversion from ‘void*’ to ‘uint8_t*’ Hello, I have this little function Uint32 moveSprite(Uint32 interval, void *param) { SDL_Rect* spritePos = param; spritePos->x++; return interval; } The problem here is quite simple, I'm using codeblocks, when i save this file as a C...
Your code is valid C, not valid C++. You need to add an explicit casting for it to compile Either C-style: SDL_Rect* spritePos = (SDL_Rect *)param; Or more C++-ish: SDL_Rect* spritePos = static_cast (param); A better solution would be to change the parameter type instead if that's possible for you. Avoid void * wheneve...
Error when compiling cpp file Possible Duplicate: C++: malloc: error: invalid conversion from ‘void*’ to ‘uint8_t*’ Hello, I have this little function Uint32 moveSprite(Uint32 interval, void *param) { SDL_Rect* spritePos = param; spritePos->x++; return interval; } The problem here is quite simple, I'm using codeblocks...
TITLE: Error when compiling cpp file QUESTION: Possible Duplicate: C++: malloc: error: invalid conversion from ‘void*’ to ‘uint8_t*’ Hello, I have this little function Uint32 moveSprite(Uint32 interval, void *param) { SDL_Rect* spritePos = param; spritePos->x++; return interval; } The problem here is quite simple, I'...
[ "c++", "c", "pointers", "sdl", "codeblocks" ]
1
4
252
2
0
2011-05-31T12:50:45.390000
2011-05-31T13:01:29.893000
6,187,835
6,188,027
vector iterators incompatible
I'm currently working on a graph library for C++ and now got stuck at a point where I get an assertion error in debug mode during runtime. I also had a look an some other question here on SO but none of the questions and answers lead me to a solution. After reading in some forums I have the impression that this error h...
My guess, given limited context you provided, is that neighbours() returns copy of std::vector, instead of reference, i.e. std::vector &. So after begin() call temporary object is disposed, and obtained iterator points to rubbish.
vector iterators incompatible I'm currently working on a graph library for C++ and now got stuck at a point where I get an assertion error in debug mode during runtime. I also had a look an some other question here on SO but none of the questions and answers lead me to a solution. After reading in some forums I have th...
TITLE: vector iterators incompatible QUESTION: I'm currently working on a graph library for C++ and now got stuck at a point where I get an assertion error in debug mode during runtime. I also had a look an some other question here on SO but none of the questions and answers lead me to a solution. After reading in som...
[ "c++", "stl", "vector", "iterator", "stdvector" ]
4
11
7,609
2
0
2011-05-31T12:51:07.660000
2011-05-31T13:06:05.570000
6,187,836
6,187,871
which data structure should i choose and why
Im writing timers manager in C, which involves: creating new timer removing timers removing dead timer freezing timers and all the other stuff which i did not yet think about. The key is - amount of memory should be as small as possible. At first i thought about linked list, but if i remove some of the middle part, i s...
You don't need to rebuild anything when removing from a linked list. It's an O(1) op. No matter what structure you'll choose you'll probably have to be careful about pointers.
which data structure should i choose and why Im writing timers manager in C, which involves: creating new timer removing timers removing dead timer freezing timers and all the other stuff which i did not yet think about. The key is - amount of memory should be as small as possible. At first i thought about linked list,...
TITLE: which data structure should i choose and why QUESTION: Im writing timers manager in C, which involves: creating new timer removing timers removing dead timer freezing timers and all the other stuff which i did not yet think about. The key is - amount of memory should be as small as possible. At first i thought ...
[ "c", "data-structures" ]
1
3
283
5
0
2011-05-31T12:51:12.480000
2011-05-31T12:54:30.987000
6,187,845
6,189,437
Add LayoutPanel to RootPanel by wrapper
i have the following problem which seems quite simple but i have spent more than 2 hours and can't solve it. Look at the following example. public class HeaderForm extends VerticalPanel { public HeaderForm() { Label label = new Label("Some text here which should be visible"); this.add(lable); } } Here is the entry poi...
I believe what you want to do is create a new Widget. Your class HeaderForm should extend Composite, and then you can make a VerticalPanel and add your label to it. The VerticalPanel is then initialised using initWidget. public class HeaderForm extends Composite { public HeaderForm() { VerticalPanel verticalPanel = new...
Add LayoutPanel to RootPanel by wrapper i have the following problem which seems quite simple but i have spent more than 2 hours and can't solve it. Look at the following example. public class HeaderForm extends VerticalPanel { public HeaderForm() { Label label = new Label("Some text here which should be visible"); thi...
TITLE: Add LayoutPanel to RootPanel by wrapper QUESTION: i have the following problem which seems quite simple but i have spent more than 2 hours and can't solve it. Look at the following example. public class HeaderForm extends VerticalPanel { public HeaderForm() { Label label = new Label("Some text here which should...
[ "java", "gwt", "layout" ]
0
2
275
1
0
2011-05-31T12:52:09.837000
2011-05-31T14:51:23.957000
6,187,848
6,188,035
VBA isnumber istext function problem
im trying to check if a number is a text or number in a banking system. If the value is incorrect it should erase and send an error message, but my code isnt working at all... can someone help me? here is the code: Private Sub TextBox1_Change() name = TextBox1 If Application.IsText(name) = True Then IsText = True Els...
I think you should be using name = TextBox1.Text instead. It's probably giving you an error on that line. Also, you may want to wait until the user is finished typing the response, I believe the changed event will run each time a character is pressed. The AfterUpdate will run after you tab or click away from the textbo...
VBA isnumber istext function problem im trying to check if a number is a text or number in a banking system. If the value is incorrect it should erase and send an error message, but my code isnt working at all... can someone help me? here is the code: Private Sub TextBox1_Change() name = TextBox1 If Application.IsTex...
TITLE: VBA isnumber istext function problem QUESTION: im trying to check if a number is a text or number in a banking system. If the value is incorrect it should erase and send an error message, but my code isnt working at all... can someone help me? here is the code: Private Sub TextBox1_Change() name = TextBox1 If...
[ "function", "vba" ]
0
1
7,738
2
0
2011-05-31T12:52:21.767000
2011-05-31T13:06:51.650000
6,187,854
6,187,889
Common mistakes in writing JavaScript with a C# background
I've been working on improving my JavaScript code. I've seen several people write that too many people write JavaScript like another language such as C#. What common things I picked up in C# are things I should do differently in JavaScript?
There is an excellent (and award winning) article on JavaScript gotchas here: http://www.codeproject.com/KB/scripting/javascript-gotchas.aspx It covers: Double-equals Global variables Constructing built-in types with the 'new' keyword Constructing anything else without the 'new' keyword parseInt doesn't assume base-10 ...
Common mistakes in writing JavaScript with a C# background I've been working on improving my JavaScript code. I've seen several people write that too many people write JavaScript like another language such as C#. What common things I picked up in C# are things I should do differently in JavaScript?
TITLE: Common mistakes in writing JavaScript with a C# background QUESTION: I've been working on improving my JavaScript code. I've seen several people write that too many people write JavaScript like another language such as C#. What common things I picked up in C# are things I should do differently in JavaScript? A...
[ "c#", "javascript", "transition" ]
3
3
318
3
0
2011-05-31T12:52:51.050000
2011-05-31T12:55:54.153000
6,187,863
6,187,903
sample/tutorial of using selenium 2.0 web driver in .net?
is there any tutorial/sample for using selenium 2.0 web driver with.net? I've tried searching but could find only java, nothing about.net and selenium 2.0 web driver
The docs here has an example in C#: http://seleniumhq.org/docs/03_webdriver.html using OpenQA.Selenium.Firefox; using OpenQA.Selenium; class GoogleSuggest { static void Main(string[] args) { IWebDriver driver = new FirefoxDriver(); //Notice navigation is slightly different than the Java version //This is because 'ge...
sample/tutorial of using selenium 2.0 web driver in .net? is there any tutorial/sample for using selenium 2.0 web driver with.net? I've tried searching but could find only java, nothing about.net and selenium 2.0 web driver
TITLE: sample/tutorial of using selenium 2.0 web driver in .net? QUESTION: is there any tutorial/sample for using selenium 2.0 web driver with.net? I've tried searching but could find only java, nothing about.net and selenium 2.0 web driver ANSWER: The docs here has an example in C#: http://seleniumhq.org/docs/03_web...
[ "asp.net", "selenium", "selenium-webdriver" ]
4
9
11,167
2
0
2011-05-31T12:53:56.573000
2011-05-31T12:57:15.987000
6,187,869
6,188,468
IE7 Javascript Hover not Working Correctly
I have made a simple Javascript on hover effect so when you hover a div the text is then displayed in the div below, but in IE7 only a random few will work such as 1,2,3,4,27,28 and a few others the rest just do not work? Here is my code: Hover Over the Numbers to Find the Answer Any Help would be great:D (You can also...
Sorry, but it took some time figuring out what is going wrong in IE7, but I think I've found your problem. You've been using margin-left and margin-top to reposition automatically aligned images. For most browsers this works fine, but IE up to and including IE7 this is buggy at best. As a result here, the body element ...
IE7 Javascript Hover not Working Correctly I have made a simple Javascript on hover effect so when you hover a div the text is then displayed in the div below, but in IE7 only a random few will work such as 1,2,3,4,27,28 and a few others the rest just do not work? Here is my code: Hover Over the Numbers to Find the Ans...
TITLE: IE7 Javascript Hover not Working Correctly QUESTION: I have made a simple Javascript on hover effect so when you hover a div the text is then displayed in the div below, but in IE7 only a random few will work such as 1,2,3,4,27,28 and a few others the rest just do not work? Here is my code: Hover Over the Numbe...
[ "javascript", "html", "css", "internet-explorer", "internet-explorer-7" ]
1
0
472
1
0
2011-05-31T12:54:20.830000
2011-05-31T13:39:42.730000
6,187,874
6,187,949
pydev - can someone please explain these errors
I am developing using PyDev in Eclipse. I have put in some comments in my code. I get wavy red lines underneath certain words. The program runs fine and there are no warnings mentioned. So what is the meaning of these wavy lines. e.g. #!/usr/bin/python - I get the line under usr and python # generated by accessing reg...
Neil speaks the truth, except for telling you to turn it off -- spell check in comments is quite helpful -- those who come after will thank you for ensuring they can read your comments without trying to decode random spelling errors. The lines are simply pointing out words your IDE thinks are spelled wrong. I don't kno...
pydev - can someone please explain these errors I am developing using PyDev in Eclipse. I have put in some comments in my code. I get wavy red lines underneath certain words. The program runs fine and there are no warnings mentioned. So what is the meaning of these wavy lines. e.g. #!/usr/bin/python - I get the line un...
TITLE: pydev - can someone please explain these errors QUESTION: I am developing using PyDev in Eclipse. I have put in some comments in my code. I get wavy red lines underneath certain words. The program runs fine and there are no warnings mentioned. So what is the meaning of these wavy lines. e.g. #!/usr/bin/python -...
[ "python", "pydev" ]
1
3
267
2
0
2011-05-31T12:54:49.243000
2011-05-31T13:00:43.527000
6,187,879
6,188,122
toolbar disappear at rotation ipad project
I added uittolbar at design time, but I noticed that it disappear at landscape mode how to fix that, I develop ipad application
Look at the toolbar's autoresizingMask. This defines the behavior of the view in response to the superview's frame change. If you've done this programmatically, it will be UIViewAutoresizingMaskNone by default. You will have to set them appropriately.
toolbar disappear at rotation ipad project I added uittolbar at design time, but I noticed that it disappear at landscape mode how to fix that, I develop ipad application
TITLE: toolbar disappear at rotation ipad project QUESTION: I added uittolbar at design time, but I noticed that it disappear at landscape mode how to fix that, I develop ipad application ANSWER: Look at the toolbar's autoresizingMask. This defines the behavior of the view in response to the superview's frame change....
[ "iphone", "objective-c", "ipad" ]
0
3
379
1
0
2011-05-31T12:55:08.130000
2011-05-31T13:12:29.227000
6,187,891
6,188,614
asp.net accessing javascript variables after ajax updatepanel
I'm using AJAX on an ASP.NET web project to update a page. Some of my functions return XML that I want to embed on the page after it reloads. This part works, here's a sample of how it looks at the top of the page: var productXML = " 123 Test Test Test Test Test Test Test Test 0 "; Later in the page I'm trying to use t...
From your code snippets, it looks like your closeLoading function is only being called in your window.onload function. This means that it won't be called after any Ajax request completes as the window won't be reloaded. I would try moving your call to Sys.WebForms.PageRequestManager.getInstance().add_endRequest(closeLo...
asp.net accessing javascript variables after ajax updatepanel I'm using AJAX on an ASP.NET web project to update a page. Some of my functions return XML that I want to embed on the page after it reloads. This part works, here's a sample of how it looks at the top of the page: var productXML = " 123 Test Test Test Test ...
TITLE: asp.net accessing javascript variables after ajax updatepanel QUESTION: I'm using AJAX on an ASP.NET web project to update a page. Some of my functions return XML that I want to embed on the page after it reloads. This part works, here's a sample of how it looks at the top of the page: var productXML = " 123 Te...
[ "c#", "javascript", "jquery", "asp.net", "ajax" ]
0
1
1,460
2
0
2011-05-31T12:56:00.830000
2011-05-31T13:50:57.117000
6,187,900
6,201,821
How do I set a JNDI variable in JBOSS?
I'm using JBoss 5.1 and I want to specify the location of my configuration files as a JNDI entry so I can look it up in my web application. How can I go about doing this properly?
There's two main ways to do this. Deployment Descriptor / Declarative Use the JNDI Binding Manager by creating a deployment descriptor in a file such as *my-jndi-bindings***-service.xml** and drop it into the server's deploy directory. An example descriptor looks like this: Hello, JNDI! Programatic Acquire a JNDI conte...
How do I set a JNDI variable in JBOSS? I'm using JBoss 5.1 and I want to specify the location of my configuration files as a JNDI entry so I can look it up in my web application. How can I go about doing this properly?
TITLE: How do I set a JNDI variable in JBOSS? QUESTION: I'm using JBoss 5.1 and I want to specify the location of my configuration files as a JNDI entry so I can look it up in my web application. How can I go about doing this properly? ANSWER: There's two main ways to do this. Deployment Descriptor / Declarative Use ...
[ "jakarta-ee", "jboss" ]
2
6
9,398
1
0
2011-05-31T12:57:01.807000
2011-06-01T13:21:01.170000
6,187,908
6,187,962
Is it possible to dynamically define a struct in C
I'm pretty sure this will end up being a really obvious question, and that's why I haven't found much information on it. Still, I thought it was worth asking:) Basically, accessing data using a struct is really fast. If data comes off the network in a form where it can be immediately processed as a struct, this is pret...
It isn't possible to dynamically define a struct that is identical to a compile-time struct. It is possible, but difficult, to create dynamic structures that can contain the information equivalent to a struct. The access to the data is less convenient than what is available at compile-time. All else apart, you cannot a...
Is it possible to dynamically define a struct in C I'm pretty sure this will end up being a really obvious question, and that's why I haven't found much information on it. Still, I thought it was worth asking:) Basically, accessing data using a struct is really fast. If data comes off the network in a form where it can...
TITLE: Is it possible to dynamically define a struct in C QUESTION: I'm pretty sure this will end up being a really obvious question, and that's why I haven't found much information on it. Still, I thought it was worth asking:) Basically, accessing data using a struct is really fast. If data comes off the network in a...
[ "c", "dynamic", "struct" ]
33
27
41,808
6
0
2011-05-31T12:57:55.910000
2011-05-31T13:01:41.113000
6,187,914
6,188,026
is it possible to export data using php in iif format?
is it possible to export data in iif format using php? like we export data in csv or excel format? Thanks
This answer suggests that IIF isn't supported any more but that there are libraries available to read/write similar formats.
is it possible to export data using php in iif format? is it possible to export data in iif format using php? like we export data in csv or excel format? Thanks
TITLE: is it possible to export data using php in iif format? QUESTION: is it possible to export data in iif format using php? like we export data in csv or excel format? Thanks ANSWER: This answer suggests that IIF isn't supported any more but that there are libraries available to read/write similar formats.
[ "php" ]
0
0
1,245
2
0
2011-05-31T12:58:37.320000
2011-05-31T13:05:58.667000
6,187,916
6,207,730
"Re-announcing" service periodically when using WCF ServiceDiscoveryBehavior announcement endpoint?
I have a Managed Discovery Service hosted with a known URI. I have a discoverable service that when it starts, it announces itself using an AnnouncementEndpoint added to the ServiceDiscoveryBehavior of the service. The specific use case I would like to solve is the following: Managed Discovery service starts. A discove...
I found the answer myself. In the scenario where you need to control announcements outside of the ServiceDiscoveryBehavior, you would use the AnnouncementClient class. AnnouncementClient client = new AnnouncementClient(announcementEndpoint); var endpointDiscoveryMetadata = EndpointDiscoveryMetadata.FromServiceEndpoint(...
"Re-announcing" service periodically when using WCF ServiceDiscoveryBehavior announcement endpoint? I have a Managed Discovery Service hosted with a known URI. I have a discoverable service that when it starts, it announces itself using an AnnouncementEndpoint added to the ServiceDiscoveryBehavior of the service. The s...
TITLE: "Re-announcing" service periodically when using WCF ServiceDiscoveryBehavior announcement endpoint? QUESTION: I have a Managed Discovery Service hosted with a known URI. I have a discoverable service that when it starts, it announces itself using an AnnouncementEndpoint added to the ServiceDiscoveryBehavior of ...
[ "wcf", ".net-4.0", "discovery", "service-discovery" ]
8
5
1,683
1
0
2011-05-31T12:58:40.883000
2011-06-01T21:09:24.453000
6,187,920
6,187,955
how to check digits present in javascript string or not
I need a regex which check the string contains only A-Z, a-z and special characters but not digits i.e. ( 0-9 ). Any help is appreciated.
You can try with this regex: ^[^\d]*$ And sample: var str = 'test123'; if ( str.match(/^[^\d]*$/) ) { alert('matches'); }
how to check digits present in javascript string or not I need a regex which check the string contains only A-Z, a-z and special characters but not digits i.e. ( 0-9 ). Any help is appreciated.
TITLE: how to check digits present in javascript string or not QUESTION: I need a regex which check the string contains only A-Z, a-z and special characters but not digits i.e. ( 0-9 ). Any help is appreciated. ANSWER: You can try with this regex: ^[^\d]*$ And sample: var str = 'test123'; if ( str.match(/^[^\d]*$/) )...
[ "javascript", "regex" ]
3
6
2,926
4
0
2011-05-31T12:58:55.920000
2011-05-31T13:01:07.717000
6,187,924
6,187,967
How to set value in table in iphone
I selected project as WindowsBased application from Xcode. I have to views in first views i have only button and in second views i have to show values in TableNavigation. I create my first view with simple WindowBased application selection. From the first screen i am able to load my second screen. I am loading secondSc...
Check this tutorial. In order to display a UITableView, you need to setup a data source and, possibly, a delegate. The data source is responsible to provide your table with the rows it should display. Read the tutorial to understand how the data source can be defined step by step.
How to set value in table in iphone I selected project as WindowsBased application from Xcode. I have to views in first views i have only button and in second views i have to show values in TableNavigation. I create my first view with simple WindowBased application selection. From the first screen i am able to load my ...
TITLE: How to set value in table in iphone QUESTION: I selected project as WindowsBased application from Xcode. I have to views in first views i have only button and in second views i have to show values in TableNavigation. I create my first view with simple WindowBased application selection. From the first screen i a...
[ "iphone", "uiviewcontroller" ]
0
0
106
2
0
2011-05-31T12:59:11.740000
2011-05-31T13:01:53.957000
6,187,931
6,188,008
EL expressions are not evaluated
I have developed a java server page which has java server faces tags. It is fetching a bean data like this: But when I run it, it is showing the value as it is and not evaluating the value. How is this caused and how can I solve it?
So, the EL expressions are not evaluated and you see #{UserBean.userName} in the webpage instead of the evaluated value? Ensure that your web.xml is declared conform the maximum supported Servlet version as supported by the webcontainer. JSF 1.2 and 2.0 requires a minimum of Servlet 2.5. JSF 2.1 requires a minimum of S...
EL expressions are not evaluated I have developed a java server page which has java server faces tags. It is fetching a bean data like this: But when I run it, it is showing the value as it is and not evaluating the value. How is this caused and how can I solve it?
TITLE: EL expressions are not evaluated QUESTION: I have developed a java server page which has java server faces tags. It is fetching a bean data like this: But when I run it, it is showing the value as it is and not evaluating the value. How is this caused and how can I solve it? ANSWER: So, the EL expressions are ...
[ "java", "jsp", "jsf", "el" ]
3
3
3,062
3
0
2011-05-31T12:59:39.537000
2011-05-31T13:04:57.540000
6,187,932
6,187,986
How to write a static python getitem method?
What do I need to change to make this work? class A: @staticmethod def __getitem__(val): return "It works" print A[0] Note that I am calling the __getitem__ method on the type A.
When an object is indexed, the special method __getitem__ is looked for first in the object's class. A class itself is an object, and the class of a class is usually type. So to override __getitem__ for a class, you can redefine its metaclass (to make it a subclass of type ): class MetaA(type): def __getitem__(cls,val)...
How to write a static python getitem method? What do I need to change to make this work? class A: @staticmethod def __getitem__(val): return "It works" print A[0] Note that I am calling the __getitem__ method on the type A.
TITLE: How to write a static python getitem method? QUESTION: What do I need to change to make this work? class A: @staticmethod def __getitem__(val): return "It works" print A[0] Note that I am calling the __getitem__ method on the type A. ANSWER: When an object is indexed, the special method __getitem__ is looked ...
[ "python", "static", "operator-keyword", "magic-methods" ]
23
32
7,383
2
0
2011-05-31T12:59:39.387000
2011-05-31T13:03:16.570000
6,187,934
6,189,539
Is there a way to show the number of "ticks" or "steps" in a jquery ui slider?
I want to show the number of ticks in my jquery ui slider, is there a way to do this? For example I have a slider with a max of 100, I want it some what like this 0--------50--------100 minus the dashes of course.
The easiest way, in my mind, is to put this above/below the slider: 0 50 100 Then style the labels appropriately. You could also insert the labels into the #slider itself, but this will probably force the slider to be thicker for readability: 50 div#slider span#step {position:relative; left:50%;}
Is there a way to show the number of "ticks" or "steps" in a jquery ui slider? I want to show the number of ticks in my jquery ui slider, is there a way to do this? For example I have a slider with a max of 100, I want it some what like this 0--------50--------100 minus the dashes of course.
TITLE: Is there a way to show the number of "ticks" or "steps" in a jquery ui slider? QUESTION: I want to show the number of ticks in my jquery ui slider, is there a way to do this? For example I have a slider with a max of 100, I want it some what like this 0--------50--------100 minus the dashes of course. ANSWER: ...
[ "jquery", "user-interface", "slider" ]
4
4
1,936
1
0
2011-05-31T12:59:43.223000
2011-05-31T14:58:57.860000
6,187,944
6,188,002
How can I create a dynamic button click event on a dynamic button?
I am creating one button on a page dynamically. Now I want to use the button click event on that button. How can I do this in C# ASP.NET?
Button button = new Button(); button.Click += (s,e) => { your code; }; //button.Click += new EventHandler(button_Click); container.Controls.Add(button); //protected void button_Click (object sender, EventArgs e) { }
How can I create a dynamic button click event on a dynamic button? I am creating one button on a page dynamically. Now I want to use the button click event on that button. How can I do this in C# ASP.NET?
TITLE: How can I create a dynamic button click event on a dynamic button? QUESTION: I am creating one button on a page dynamically. Now I want to use the button click event on that button. How can I do this in C# ASP.NET? ANSWER: Button button = new Button(); button.Click += (s,e) => { your code; }; //button.Click +=...
[ "c#", "asp.net", ".net", "button", "event-handling" ]
46
62
229,630
6
0
2011-05-31T13:00:26.103000
2011-05-31T13:04:34.843000
6,187,960
6,215,397
Submiting a form that is inside a div with AJAX
I'm trying to submit a form using AJAX to stop the browser from refreshing the page. The form is located inside a secondary page, that is called into the main page div ( similar to using a master page and the content placeholder ). I have been trying several methods but I always reach the same problem. Whenever I try t...
It seems that the method I was using for the content load was building a xmlHttpRquest and it was conflicting with the response that I got from the jquery.
Submiting a form that is inside a div with AJAX I'm trying to submit a form using AJAX to stop the browser from refreshing the page. The form is located inside a secondary page, that is called into the main page div ( similar to using a master page and the content placeholder ). I have been trying several methods but I...
TITLE: Submiting a form that is inside a div with AJAX QUESTION: I'm trying to submit a form using AJAX to stop the browser from refreshing the page. The form is located inside a secondary page, that is called into the main page div ( similar to using a master page and the content placeholder ). I have been trying sev...
[ "c#", "jquery", "asp.net", "ajax" ]
0
0
221
3
0
2011-05-31T13:01:35.923000
2011-06-02T13:47:08.043000
6,187,968
6,289,181
Fuzz-testing XML-parser
I want to fuzz-test a XML-parser and wonder if there are some appropriate fuzzers. It would be nice not only generate random garbage, but take advantages of existing schema specification like XSD or DTD.
Following are some XML fuzzers that I chanced upon, during a search several months back: untidy. This is does not appear to be in active development, with the last update in 2007. (Project no longer available on Sourceforge, for posterity see archive.org for partial content, and packetstorm for download. It was added t...
Fuzz-testing XML-parser I want to fuzz-test a XML-parser and wonder if there are some appropriate fuzzers. It would be nice not only generate random garbage, but take advantages of existing schema specification like XSD or DTD.
TITLE: Fuzz-testing XML-parser QUESTION: I want to fuzz-test a XML-parser and wonder if there are some appropriate fuzzers. It would be nice not only generate random garbage, but take advantages of existing schema specification like XSD or DTD. ANSWER: Following are some XML fuzzers that I chanced upon, during a sear...
[ "xml", "xsd", "fuzzing" ]
8
7
6,980
3
0
2011-05-31T13:02:06.993000
2011-06-09T07:00:48.547000
6,187,973
6,189,891
'StringCut' to the left or right of a defined position using Mathematica
On reading this question, I thought the following problem would be simple using StringSplit Given the following string, I want to 'cut' it to the left of every "D" such that: I get a List of fragments (with sequence unchanged) StringJoin @fragments gives back the original string (but is does not matter if I have to reo...
Here are some alternate solutions: Splitting by any occurrence of "D": In[18]:= StringJoin /@ Split[Characters["MTPDKPSQYDKIEAELQDICNDVLELLDSKGDYFRYLSEVASGDN"], #2!="D" &] Out[18]:= {"MTP", "DKPSQY", "DKIEAELQ", "DICN", "DVLELL", "DSKG", "DYFRYLSEVASG", "DN"} Splitting by any occurrence of "D" provided it is not preced...
'StringCut' to the left or right of a defined position using Mathematica On reading this question, I thought the following problem would be simple using StringSplit Given the following string, I want to 'cut' it to the left of every "D" such that: I get a List of fragments (with sequence unchanged) StringJoin @fragment...
TITLE: 'StringCut' to the left or right of a defined position using Mathematica QUESTION: On reading this question, I thought the following problem would be simple using StringSplit Given the following string, I want to 'cut' it to the left of every "D" such that: I get a List of fragments (with sequence unchanged) St...
[ "string", "wolfram-mathematica", "bioinformatics" ]
9
3
403
3
0
2011-05-31T13:02:27.840000
2011-05-31T15:25:35.800000
6,187,974
6,188,095
Class prototyping
I have put several instances of class b in class a but this causes an error as class a does not know what class b is. Now I know I can solve this problem by writing my file b a c but this messes up the reachability as well as annoys me. I know I can prototype my functions so I do not have this problem but have been abl...
You can declare all your classes and then define them in any order, like so: // Declare my classes class A; class B; class C; // Define my classes (any order will do) class A {... }; class B {... }; class C {... };
Class prototyping I have put several instances of class b in class a but this causes an error as class a does not know what class b is. Now I know I can solve this problem by writing my file b a c but this messes up the reachability as well as annoys me. I know I can prototype my functions so I do not have this problem...
TITLE: Class prototyping QUESTION: I have put several instances of class b in class a but this causes an error as class a does not know what class b is. Now I know I can solve this problem by writing my file b a c but this messes up the reachability as well as annoys me. I know I can prototype my functions so I do not...
[ "c++", "prototype", "class-design" ]
14
30
49,337
4
0
2011-05-31T13:02:30.007000
2011-05-31T13:11:13.220000
6,187,975
6,188,015
How to create bitmap from sdcard images in android?
I need to create a bitmap from sdcard images so after getting uri of image i am getting byte data by opening inputStream as follows public byte[] getBytesFromFile(InputStream is) { byte[] data = null; ByteArrayOutputStream buffer=null; try { buffer = new ByteArrayOutputStream(); int nRead; data = new byte[16384]; whil...
Try to use the BitmapFactory.decodeStream() method instead of first loading the bytearray into memory. Also check out this question for more info on loading bitmaps.
How to create bitmap from sdcard images in android? I need to create a bitmap from sdcard images so after getting uri of image i am getting byte data by opening inputStream as follows public byte[] getBytesFromFile(InputStream is) { byte[] data = null; ByteArrayOutputStream buffer=null; try { buffer = new ByteArrayOutp...
TITLE: How to create bitmap from sdcard images in android? QUESTION: I need to create a bitmap from sdcard images so after getting uri of image i am getting byte data by opening inputStream as follows public byte[] getBytesFromFile(InputStream is) { byte[] data = null; ByteArrayOutputStream buffer=null; try { buffer =...
[ "android", "image", "bitmap", "out-of-memory" ]
0
1
3,619
1
0
2011-05-31T13:02:31.437000
2011-05-31T13:05:22
6,187,978
6,188,660
"EntityState must be set to null, Created (for Create message) or Changed (for Update message)" when attempting to update an entity in CRM 2011
I am using the following code to update an entity. Service.Update(_policy); where policy is a class generated using CrmSvcUtil.exe public partial class new_policy: Microsoft.Xrm.Sdk.Entity, System.ComponentModel.INotifyPropertyChanging, System.ComponentModel.INotifyPropertyChanged I retrieve the policies using LINQ, th...
You have to tell your crmContext (use appropriate name) what to do with the changes. You should add crmContext.UpdateObject(contact); before crmContext.SaveChanges(); See also How to update a CRM 2011 Entity using LINQ in a Plugin?
"EntityState must be set to null, Created (for Create message) or Changed (for Update message)" when attempting to update an entity in CRM 2011 I am using the following code to update an entity. Service.Update(_policy); where policy is a class generated using CrmSvcUtil.exe public partial class new_policy: Microsoft.Xr...
TITLE: "EntityState must be set to null, Created (for Create message) or Changed (for Update message)" when attempting to update an entity in CRM 2011 QUESTION: I am using the following code to update an entity. Service.Update(_policy); where policy is a class generated using CrmSvcUtil.exe public partial class new_po...
[ "dynamics-crm-2011" ]
16
21
22,602
5
0
2011-05-31T13:02:48.960000
2011-05-31T13:54:47.600000
6,187,979
6,190,125
Delegate as first param to an Extension Method
Ladies and Gents, I recently tried this experiment: static class TryParseExtensions { public delegate bool TryParseMethod (string s, out T maybeValue); public static T? OrNull (this TryParseMethod tryParser, string s) where T:struct { T result; return tryParser(s, out result)? (T?)result: null; } } // compiler error "...
You have a number of questions here. (In the future I would recommend that when you have multiple questions, split them up into multiple questions rather than one posting with several questions in it; you'll probably get better responses.) Why can the compiler not infer the "int" type parameter in: TryParseExtensions.O...
Delegate as first param to an Extension Method Ladies and Gents, I recently tried this experiment: static class TryParseExtensions { public delegate bool TryParseMethod (string s, out T maybeValue); public static T? OrNull (this TryParseMethod tryParser, string s) where T:struct { T result; return tryParser(s, out resu...
TITLE: Delegate as first param to an Extension Method QUESTION: Ladies and Gents, I recently tried this experiment: static class TryParseExtensions { public delegate bool TryParseMethod (string s, out T maybeValue); public static T? OrNull (this TryParseMethod tryParser, string s) where T:struct { T result; return try...
[ "c#", "delegates", "extension-methods" ]
9
20
2,017
3
0
2011-05-31T13:02:51.670000
2011-05-31T15:45:29.053000
6,187,981
6,265,016
save the uploaded .doc file to db with html format
In my application,user can upload some doc files to the server,and I want user who do not install ms office can read these documents,so I want to convert the.doc to html and then save the html(binary stream) to oracle db. I wonder if there is a best pratice to implement this? Someone tell me to use the com object provo...
You might need to give everyone a bit more information... I assume you're using a server side technology? Which one? What database are you using? The chances are if the COM object is writing it to a file, you will - like you say, just need to copy that into the DB, and delete the temp file. IMHO - There should be nothi...
save the uploaded .doc file to db with html format In my application,user can upload some doc files to the server,and I want user who do not install ms office can read these documents,so I want to convert the.doc to html and then save the html(binary stream) to oracle db. I wonder if there is a best pratice to implemen...
TITLE: save the uploaded .doc file to db with html format QUESTION: In my application,user can upload some doc files to the server,and I want user who do not install ms office can read these documents,so I want to convert the.doc to html and then save the html(binary stream) to oracle db. I wonder if there is a best p...
[ "asp.net", "html", "doc" ]
0
0
572
1
0
2011-05-31T13:03:00.290000
2011-06-07T12:18:18.603000
6,187,988
6,188,041
Set where the click is going to happen
html: Somthing Somthing Somthing Somthing Jquery $("#tr").click(function(){ // something happen }); so, the question is: the click effect obviously will get all the stuffs inside the can the click effect just happen when i click in the first 3 td's inside the? edit: if i have more then 1 tr Somthing Somthing Somthing...
Try using the lt (less than) selector. $('.specialTD td:lt(4)').click(function(){ // what cell was clicked? var clickedId = $(this).attr('id'); }); UPDATE: You can assign a class name that will be same on all rows, and an individual id to each td. See updated example above
Set where the click is going to happen html: Somthing Somthing Somthing Somthing Jquery $("#tr").click(function(){ // something happen }); so, the question is: the click effect obviously will get all the stuffs inside the can the click effect just happen when i click in the first 3 td's inside the? edit: if i have mo...
TITLE: Set where the click is going to happen QUESTION: html: Somthing Somthing Somthing Somthing Jquery $("#tr").click(function(){ // something happen }); so, the question is: the click effect obviously will get all the stuffs inside the can the click effect just happen when i click in the first 3 td's inside the? ...
[ "javascript", "jquery" ]
0
4
84
4
0
2011-05-31T13:03:31.970000
2011-05-31T13:07:23.220000
6,187,989
6,188,018
asp.net web-config error
I have still problem with asp.net project. In Visual studio when i start debug it is all good and page working but, when i try it on iis7 showse this error. SHOW ERROR: Configuration Error Description: An error occurred during the processing of a configuration file required to service this request. Please review the sp...
Change the.NET version on the Application pool for your website. It must be.NET 4.0, not the.NET 2.0 View a List of Application Pools (IIS 7)
asp.net web-config error I have still problem with asp.net project. In Visual studio when i start debug it is all good and page working but, when i try it on iis7 showse this error. SHOW ERROR: Configuration Error Description: An error occurred during the processing of a configuration file required to service this requ...
TITLE: asp.net web-config error QUESTION: I have still problem with asp.net project. In Visual studio when i start debug it is all good and page working but, when i try it on iis7 showse this error. SHOW ERROR: Configuration Error Description: An error occurred during the processing of a configuration file required to...
[ "asp.net", "iis-7", "configuration" ]
2
6
7,364
3
0
2011-05-31T13:03:32.707000
2011-05-31T13:05:25.140000
6,187,993
6,188,061
C++ if statement seems to ignore the argument
Here's the code. bool b_div(int n_dividend) { for (int iii = 10; iii>0; iii--) { int n_remainder = n_dividend%iii; if (n_remainder!= 0) return false; if (iii = 1) return true; } } After testing this function I made for a program, the function seems to stop at the if (n_remainder!= 0) part. Now then the function SHOULD...
Change your last if statement to: if (iii == 1) return true; Currently you have only a single equals sign, which sets the variable iii to 1, and is always true. By using a double equals it will compare iii and 1.
C++ if statement seems to ignore the argument Here's the code. bool b_div(int n_dividend) { for (int iii = 10; iii>0; iii--) { int n_remainder = n_dividend%iii; if (n_remainder!= 0) return false; if (iii = 1) return true; } } After testing this function I made for a program, the function seems to stop at the if (n_rem...
TITLE: C++ if statement seems to ignore the argument QUESTION: Here's the code. bool b_div(int n_dividend) { for (int iii = 10; iii>0; iii--) { int n_remainder = n_dividend%iii; if (n_remainder!= 0) return false; if (iii = 1) return true; } } After testing this function I made for a program, the function seems to sto...
[ "function", "if-statement", "arguments" ]
3
9
1,625
2
0
2011-05-31T13:03:41.440000
2011-05-31T13:08:50.550000
6,187,996
6,188,091
Static Block and Main Thread
I found a very interesting thing while trying with java. Please find the code below: public class SimpleTest { static{ System.out.println(Thread.currentThread().getName()); System.exit(0); } } The above program runs without any exception (Well & good since I'm exiting in the static block itself). But i got the followin...
The main class is loaded and initialized on the main thread. Although this is not documented explicitly anywhere (as far as I know), it's a pretty safe assumption, as there's hardly a reason to implement it differently.
Static Block and Main Thread I found a very interesting thing while trying with java. Please find the code below: public class SimpleTest { static{ System.out.println(Thread.currentThread().getName()); System.exit(0); } } The above program runs without any exception (Well & good since I'm exiting in the static block it...
TITLE: Static Block and Main Thread QUESTION: I found a very interesting thing while trying with java. Please find the code below: public class SimpleTest { static{ System.out.println(Thread.currentThread().getName()); System.exit(0); } } The above program runs without any exception (Well & good since I'm exiting in t...
[ "java", "jvm", "static-block" ]
5
3
1,415
5
0
2011-05-31T13:03:57.977000
2011-05-31T13:10:43.890000
6,187,997
6,188,137
Generic Select Stored Procedure
I want to create a stored procedure based following way: ALTER PROCEDURE spGetLastId ( @table_name varchar(100) ) AS BEGIN DECLARE @DBSql varchar(2000) SET @DBSql = 'SELECT MAX(id) as ''LastId'' FROM ' + @table_name EXEC sp_executesql @DBSql END This procedure will have to display the last id of any table that I pass a...
Change @DBSql from varchar to nvarchar and that will work, alternatively look at the built-in IDENT_CURRENT().
Generic Select Stored Procedure I want to create a stored procedure based following way: ALTER PROCEDURE spGetLastId ( @table_name varchar(100) ) AS BEGIN DECLARE @DBSql varchar(2000) SET @DBSql = 'SELECT MAX(id) as ''LastId'' FROM ' + @table_name EXEC sp_executesql @DBSql END This procedure will have to display the la...
TITLE: Generic Select Stored Procedure QUESTION: I want to create a stored procedure based following way: ALTER PROCEDURE spGetLastId ( @table_name varchar(100) ) AS BEGIN DECLARE @DBSql varchar(2000) SET @DBSql = 'SELECT MAX(id) as ''LastId'' FROM ' + @table_name EXEC sp_executesql @DBSql END This procedure will have...
[ "sql-server-2005", "stored-procedures" ]
3
3
626
3
0
2011-05-31T13:03:58.990000
2011-05-31T13:13:13.727000
6,188,006
6,188,051
Can I have transparent background in fullscreen flash?
Is there a way to get transparent background when in fullscreen mode in flash? I tried the following: Fullscreen Test The fullscreen.swf I compiled width Flex 4.5: public function toggleFullScreen():void { if (this.stage.displayState == StageDisplayState.NORMAL) { this.stage.displayState = StageDisplayState.FULL_SCREEN...
I'm pretty sure that is not possible.. EDIT: It isn't possible.. EDIT2: Added a link From the AS3 docs ( link ) Note: If you set the Window Mode (wmode in the HTML) to Opaque Windowless (opaque) or Transparent Windowless (transparent), the full-screen window is always opaque
Can I have transparent background in fullscreen flash? Is there a way to get transparent background when in fullscreen mode in flash? I tried the following: Fullscreen Test The fullscreen.swf I compiled width Flex 4.5: public function toggleFullScreen():void { if (this.stage.displayState == StageDisplayState.NORMAL) { ...
TITLE: Can I have transparent background in fullscreen flash? QUESTION: Is there a way to get transparent background when in fullscreen mode in flash? I tried the following: Fullscreen Test The fullscreen.swf I compiled width Flex 4.5: public function toggleFullScreen():void { if (this.stage.displayState == StageDispl...
[ "flash", "apache-flex", "fullscreen", "transparent", "wmode" ]
1
1
940
1
0
2011-05-31T13:04:54.097000
2011-05-31T13:08:21.767000
6,188,010
6,188,615
Select numbered list of duplicate entries
Really simple example: Let's say I have this table: ID Name GUID1 John GUID2 John GUID3 John GUID4 John GUID5 Jane GUID6 Jane I would like to do a select which assigns a counter to every occurence of the same name (starting at 1 each time). i.e.: ID Name Counter GUID1 John 1 GUID2 John 2 GUID3 John 3 GUID4 John 4 GUID5...
declare @T table(ID varchar(10), Name varchar(10)) insert into @T values ('GUID1', 'John'), ('GUID2', 'John'), ('GUID3', 'John'), ('GUID4', 'John'), ('GUID5', 'Jane'), ('GUID6', 'Jane') select ID, Name, row_number() over(partition by Name order by ID) as Counter from @T order by ID
Select numbered list of duplicate entries Really simple example: Let's say I have this table: ID Name GUID1 John GUID2 John GUID3 John GUID4 John GUID5 Jane GUID6 Jane I would like to do a select which assigns a counter to every occurence of the same name (starting at 1 each time). i.e.: ID Name Counter GUID1 John 1 GU...
TITLE: Select numbered list of duplicate entries QUESTION: Really simple example: Let's say I have this table: ID Name GUID1 John GUID2 John GUID3 John GUID4 John GUID5 Jane GUID6 Jane I would like to do a select which assigns a counter to every occurence of the same name (starting at 1 each time). i.e.: ID Name Count...
[ "sql-server", "select", "duplicates", "sql-server-2008-r2" ]
1
1
178
1
0
2011-05-31T13:05:04.110000
2011-05-31T13:50:57.570000
6,188,013
6,188,932
Castle ActiveRecord - SessionScopeWebModule
Now and again im getting the following error "Seems that the framework isn't configured properly. (isWeb!= true and SessionScopeWebModule is in use) Check the documentation for further information" and my web app crashes my web.config is so.. any ideas, on what I need to change\add? thank you
isWeb is case sensitive. From the source: XmlAttribute isWebAtt = section.Attributes["isWeb"]; They aren't being nice about case:)
Castle ActiveRecord - SessionScopeWebModule Now and again im getting the following error "Seems that the framework isn't configured properly. (isWeb!= true and SessionScopeWebModule is in use) Check the documentation for further information" and my web app crashes my web.config is so.. any ideas, on what I need to chan...
TITLE: Castle ActiveRecord - SessionScopeWebModule QUESTION: Now and again im getting the following error "Seems that the framework isn't configured properly. (isWeb!= true and SessionScopeWebModule is in use) Check the documentation for further information" and my web app crashes my web.config is so.. any ideas, on w...
[ "c#", "castle-activerecord" ]
1
2
295
1
0
2011-05-31T13:05:15.360000
2011-05-31T14:16:11.983000
6,188,024
6,188,196
Array: subtract by row
How can I subtract a vector of each row in a array? a <- array(1:8, dim=c(2,2,2)) a,, 1 [,1] [,2] [1,] 1 3 [2,] 2 4,, 2 [,1] [,2] [1,] 5 7 [2,] 6 8 Using apply gives me: apply(a,c(1,2), '-',c(1,5)),, 1 [,1] [,2] [1,] 0 1 [2,] 0 1,, 2 [,1] [,2] [1,] 2 3 [2,] 2 3 What I am trying to get is:,, 1 [,1] [,2] [1,] 0 -2 [...
Use sweep to operate on a particular margin of the array: rows are the second dimension (margin). sweep(a,MARGIN=2,c(1,5),FUN="-")
Array: subtract by row How can I subtract a vector of each row in a array? a <- array(1:8, dim=c(2,2,2)) a,, 1 [,1] [,2] [1,] 1 3 [2,] 2 4,, 2 [,1] [,2] [1,] 5 7 [2,] 6 8 Using apply gives me: apply(a,c(1,2), '-',c(1,5)),, 1 [,1] [,2] [1,] 0 1 [2,] 0 1,, 2 [,1] [,2] [1,] 2 3 [2,] 2 3 What I am trying to get is:,, 1...
TITLE: Array: subtract by row QUESTION: How can I subtract a vector of each row in a array? a <- array(1:8, dim=c(2,2,2)) a,, 1 [,1] [,2] [1,] 1 3 [2,] 2 4,, 2 [,1] [,2] [1,] 5 7 [2,] 6 8 Using apply gives me: apply(a,c(1,2), '-',c(1,5)),, 1 [,1] [,2] [1,] 0 1 [2,] 0 1,, 2 [,1] [,2] [1,] 2 3 [2,] 2 3 What I am try...
[ "r" ]
8
16
12,790
4
0
2011-05-31T13:05:40.753000
2011-05-31T13:17:34.187000
6,188,030
6,188,064
Recommended registry usage
In XP, we used to keep configuration parameters of our application in application specific registry keys under HKLM\Software. The application needs to read and write these values. With the new security model introduced in Vista and Windows 7, these applications won’t work in Vista and Windows 7, unless they are Run “As...
HKLM is for values that affect all users on the computer. Use a key under HKCU for values that affect only the current user. Your application does not need to be elevated to write under HKCU. If only one person uses each machine (it's on their desk or it's their laptop) this distinction matters very little to you, and ...
Recommended registry usage In XP, we used to keep configuration parameters of our application in application specific registry keys under HKLM\Software. The application needs to read and write these values. With the new security model introduced in Vista and Windows 7, these applications won’t work in Vista and Windows...
TITLE: Recommended registry usage QUESTION: In XP, we used to keep configuration parameters of our application in application specific registry keys under HKLM\Software. The application needs to read and write these values. With the new security model introduced in Vista and Windows 7, these applications won’t work in...
[ "windows", "windows-7", "windows-xp" ]
0
2
191
1
0
2011-05-31T13:06:16.840000
2011-05-31T13:08:53.593000
6,188,036
6,188,458
InstantiationException when using subclass of EditTextPreference
Assume, I have a subclass of EditTextPreference called PasswordProtectedEditTextPreference. This subclass basically shows a password dialog before one can edit the preference by the EditTextPreference 's own dialog. Now I define the preference in the corresponding preferences.xml like this: Then I apply preferences.xml...
You created an abstract class: public abstract class PasswordProtectedEditTextPreference No wonder it can't be instantiated;-)
InstantiationException when using subclass of EditTextPreference Assume, I have a subclass of EditTextPreference called PasswordProtectedEditTextPreference. This subclass basically shows a password dialog before one can edit the preference by the EditTextPreference 's own dialog. Now I define the preference in the corr...
TITLE: InstantiationException when using subclass of EditTextPreference QUESTION: Assume, I have a subclass of EditTextPreference called PasswordProtectedEditTextPreference. This subclass basically shows a password dialog before one can edit the preference by the EditTextPreference 's own dialog. Now I define the pref...
[ "android", "exception", "instantiation", "inflate" ]
1
7
3,213
2
0
2011-05-31T13:06:59.883000
2011-05-31T13:39:01.987000
6,188,037
6,191,309
Using multiple CodeMirror editors on a single page?
I'm writing a page with examples that demonstrate the use of my js library. I'd like these examples to be editable and runnable, so I thought I have these options: Use prettify to display code on the tutorial page, have a button that opens a new window with the editor where you can run the code (currently implemented s...
You could use the same technique that Marijn Haverbeke (the creator of CodeMirror) uses for the online version of his javascript book. It shows code snippets, and provides an edit-button that opens a javascript console at the bottom of the screen. Look at this chapter for an example.
Using multiple CodeMirror editors on a single page? I'm writing a page with examples that demonstrate the use of my js library. I'd like these examples to be editable and runnable, so I thought I have these options: Use prettify to display code on the tutorial page, have a button that opens a new window with the editor...
TITLE: Using multiple CodeMirror editors on a single page? QUESTION: I'm writing a page with examples that demonstrate the use of my js library. I'd like these examples to be editable and runnable, so I thought I have these options: Use prettify to display code on the tutorial page, have a button that opens a new wind...
[ "javascript", "prettify", "codemirror" ]
3
5
4,609
1
0
2011-05-31T13:07:02.950000
2011-05-31T17:35:56.910000
6,188,038
6,188,077
why are getters and setters required in objective c?
i have read several answers on stackoverflow with this question in my mind, but my question is a little different. what i want to know is for variables that are not dependent on other variables of the class, why can't i declare the variable public like we do in java and then access the variable directly? i mean in obje...
because it is fundamentally wrong. If you expose a member variable as public, you are exposing internal details of a storage strategy which is not supposed to be known to the client. This will make your life much harder if, in the future, you want to implement smart strategies like allocation on the fly, or even just p...
why are getters and setters required in objective c? i have read several answers on stackoverflow with this question in my mind, but my question is a little different. what i want to know is for variables that are not dependent on other variables of the class, why can't i declare the variable public like we do in java ...
TITLE: why are getters and setters required in objective c? QUESTION: i have read several answers on stackoverflow with this question in my mind, but my question is a little different. what i want to know is for variables that are not dependent on other variables of the class, why can't i declare the variable public l...
[ "objective-c-2.0" ]
1
2
137
1
0
2011-05-31T13:07:03.953000
2011-05-31T13:09:51.060000
6,188,044
6,188,073
PHP combine values from loop
If I want to display the text as follows in example, how can it be done? $tmp=mysql_query("SELECT... FROM...."); $total=mysql_num_rows($tmp); $tekst1='Your total number of friends are: '.$total.'. Your friends are: '; while($p=mysql_fetch_array($tmp)) { $tekst2=$p['friend'].", "; } $text_complete=$tekst1.$tekst2; echo ...
I think you shoul do like this: $tmp=mysql_query("SELECT... FROM...."); $total=mysql_num_rows($tmp); $tekst1='Your total number of friends are: '.$total.'. Your friends are: '; $friends = array(); while($p = mysql_fetch_array($tmp)) { $friends[] = $p['friend']; } $tekst2= implode(', ', $friends); $text_complete=$tekst1...
PHP combine values from loop If I want to display the text as follows in example, how can it be done? $tmp=mysql_query("SELECT... FROM...."); $total=mysql_num_rows($tmp); $tekst1='Your total number of friends are: '.$total.'. Your friends are: '; while($p=mysql_fetch_array($tmp)) { $tekst2=$p['friend'].", "; } $text_co...
TITLE: PHP combine values from loop QUESTION: If I want to display the text as follows in example, how can it be done? $tmp=mysql_query("SELECT... FROM...."); $total=mysql_num_rows($tmp); $tekst1='Your total number of friends are: '.$total.'. Your friends are: '; while($p=mysql_fetch_array($tmp)) { $tekst2=$p['friend'...
[ "php" ]
1
1
174
6
0
2011-05-31T13:07:43.080000
2011-05-31T13:09:35.353000
6,188,047
6,188,291
why do we divide a mysql table into many smaller tables?
it seems that it is a common practice to divide the data of one table into many databases, many tables to improve performance, i can understand the many databases part, because more databases provides more CPUS, more memories, more IO capacity. but many tables? why not just use mysql partitions http://dev.mysql.com/doc...
I think you have a few terms mixed up here. All your data goes into one database (aka schema). In a database you can have tables. e.g. table employee id integer name varchar address varchar country varchar table office id integer employee_id integer address varchar Inside tables you have fields (id, name, address) aka...
why do we divide a mysql table into many smaller tables? it seems that it is a common practice to divide the data of one table into many databases, many tables to improve performance, i can understand the many databases part, because more databases provides more CPUS, more memories, more IO capacity. but many tables? w...
TITLE: why do we divide a mysql table into many smaller tables? QUESTION: it seems that it is a common practice to divide the data of one table into many databases, many tables to improve performance, i can understand the many databases part, because more databases provides more CPUS, more memories, more IO capacity. ...
[ "mysql", "performance" ]
11
31
7,276
2
0
2011-05-31T13:07:49.310000
2011-05-31T13:25:51.057000
6,188,053
6,188,121
Eclipse = What happens if a class is included in project and library
What happens if a class (x.java) file exists both in the current project and in the library it uses. Which one will it take?
It should be the one first loaded by the order defined in Project Properties->Java Build Path->Order and Export.
Eclipse = What happens if a class is included in project and library What happens if a class (x.java) file exists both in the current project and in the library it uses. Which one will it take?
TITLE: Eclipse = What happens if a class is included in project and library QUESTION: What happens if a class (x.java) file exists both in the current project and in the library it uses. Which one will it take? ANSWER: It should be the one first loaded by the order defined in Project Properties->Java Build Path->Orde...
[ "java", "eclipse" ]
2
6
80
2
0
2011-05-31T13:08:25.763000
2011-05-31T13:12:22.513000
6,188,055
6,188,140
Modifying a query result to return a more usable array with PHP
Hey everyone, I have a query result returned as an array with active record: Array ( [0] => Array ( [name] => Betty Glassmaker ) [1] => Array ( [name] => John Johnson ) [2] => Array ( [name] => Bill Pratt ) ) But since my query specifically only asks for the name column, I would rather the results be modified to reflec...
You could loop through your array, something like this ( not tested ) // $resultset is you multidimensional array $optimised = Array(); // good habit to initialise before usage. foreach($resultset as $key => $value){ $optimised[] = $value['name']; } Good-luck!
Modifying a query result to return a more usable array with PHP Hey everyone, I have a query result returned as an array with active record: Array ( [0] => Array ( [name] => Betty Glassmaker ) [1] => Array ( [name] => John Johnson ) [2] => Array ( [name] => Bill Pratt ) ) But since my query specifically only asks for t...
TITLE: Modifying a query result to return a more usable array with PHP QUESTION: Hey everyone, I have a query result returned as an array with active record: Array ( [0] => Array ( [name] => Betty Glassmaker ) [1] => Array ( [name] => John Johnson ) [2] => Array ( [name] => Bill Pratt ) ) But since my query specifical...
[ "php", "arrays", "activerecord" ]
0
2
43
1
0
2011-05-31T13:08:32.660000
2011-05-31T13:13:29.910000
6,188,058
6,190,009
Duplicate module entry in Orchard CMS Modules Dashboard
I have been working through building a module for Orchard; based upon the N-N relationship tutorial. After getting the project working once I went through and changed the namespace, various classes and variable names as I had made various assumptions about names that did not pan out. Since this renaming exercise the Mo...
I appear to have over-engineered my module.txt, as removing the "Features" section of the file sorts out the duplication issue. Along with some additional fields and some reordering here is my new working module.txt: Name: Definition List AntiForgery: enabled Author: Richard Slater Website: http://www.richard-slater.co...
Duplicate module entry in Orchard CMS Modules Dashboard I have been working through building a module for Orchard; based upon the N-N relationship tutorial. After getting the project working once I went through and changed the namespace, various classes and variable names as I had made various assumptions about names t...
TITLE: Duplicate module entry in Orchard CMS Modules Dashboard QUESTION: I have been working through building a module for Orchard; based upon the N-N relationship tutorial. After getting the project working once I went through and changed the namespace, various classes and variable names as I had made various assumpt...
[ ".net", "asp.net", "asp.net-mvc", "asp.net-mvc-3", "orchardcms" ]
3
1
760
2
0
2011-05-31T13:08:37.747000
2011-05-31T15:36:21.350000
6,188,062
6,188,134
Passing a variable from PHP to jQuery on page load
I'm trying to take a reference variable from the url, and query my database when the user first visits the page. I then need to take this results and plot on google maps. This is my code at the top of my index page, it works fine, the print_r gives the correct results. I'm just not sure how to pass these results to jQu...
Something like this Now the markers JavaScript variable will be available to any scripts following the above. You can access associative entries from the PHP $row array using var latlng = markers.latlng; While we're here, you should protect your query from SQL injection. Whilst I always recommend using PDO and paramete...
Passing a variable from PHP to jQuery on page load I'm trying to take a reference variable from the url, and query my database when the user first visits the page. I then need to take this results and plot on google maps. This is my code at the top of my index page, it works fine, the print_r gives the correct results....
TITLE: Passing a variable from PHP to jQuery on page load QUESTION: I'm trying to take a reference variable from the url, and query my database when the user first visits the page. I then need to take this results and plot on google maps. This is my code at the top of my index page, it works fine, the print_r gives th...
[ "php", "jquery", "variables" ]
1
2
1,295
3
0
2011-05-31T13:08:51.990000
2011-05-31T13:13:03.517000
6,188,065
6,190,724
Listview selecting muliple indexes
For a ListView where I can select multiple items from the list, my method for the selected Index will be called if I'm selecting one item. But I I select more than one at a time my 'TheSelectedIndex' method is not being called. I want it to be called for any type of selection. zero items, 1 item ore more than 1 item. H...
One way to handle this is to ensure that the type to which you bind the ItemsSource property exposes an IsSelected property. This may mean wrapping that type into a custom ViewModel class that simply exposes the underlying type and adds an IsSelected property. Once you introduce the concept of selection state to the in...
Listview selecting muliple indexes For a ListView where I can select multiple items from the list, my method for the selected Index will be called if I'm selecting one item. But I I select more than one at a time my 'TheSelectedIndex' method is not being called. I want it to be called for any type of selection. zero it...
TITLE: Listview selecting muliple indexes QUESTION: For a ListView where I can select multiple items from the list, my method for the selected Index will be called if I'm selecting one item. But I I select more than one at a time my 'TheSelectedIndex' method is not being called. I want it to be called for any type of ...
[ "wpf" ]
0
1
903
2
0
2011-05-31T13:09:06.450000
2011-05-31T16:37:37.100000
6,188,066
6,188,109
concatenating NSStrings not work
I am trying to concatenate the contents of an NSMutableArray using NSString* result = @""; for(NSString* test in self.selectedOnes) { NSLog(test); [result stringByAppendingString:test]; [result stringByAppendingString:@","]; } but result remains @"", I am sure that the selectedOnes contains data because it writes to ...
stringByAppendingString: returns a new String. This should work. NSString* result = @""; for(NSString* test in self.SelectedOnes ) { NSLog( test ); result = [result stringByAppendingString:test]; result = [result stringByAppendingString:@","]; }
concatenating NSStrings not work I am trying to concatenate the contents of an NSMutableArray using NSString* result = @""; for(NSString* test in self.selectedOnes) { NSLog(test); [result stringByAppendingString:test]; [result stringByAppendingString:@","]; } but result remains @"", I am sure that the selectedOnes co...
TITLE: concatenating NSStrings not work QUESTION: I am trying to concatenate the contents of an NSMutableArray using NSString* result = @""; for(NSString* test in self.selectedOnes) { NSLog(test); [result stringByAppendingString:test]; [result stringByAppendingString:@","]; } but result remains @"", I am sure that t...
[ "iphone", "objective-c", "ios" ]
1
2
114
4
0
2011-05-31T13:09:07.540000
2011-05-31T13:11:57.673000
6,188,067
6,188,186
How to print the pdf file from wireless printer?
I want to print the pdf file from wireless printer. Is there any API available for printing? Please suggest me how can I do this. Thanks Monali
There is no API built into Android for wireless printing. You will need to contact the manufacturer of the wireless printer in question to see what protocols they support, then see if there is a third-party library for such a protocol.
How to print the pdf file from wireless printer? I want to print the pdf file from wireless printer. Is there any API available for printing? Please suggest me how can I do this. Thanks Monali
TITLE: How to print the pdf file from wireless printer? QUESTION: I want to print the pdf file from wireless printer. Is there any API available for printing? Please suggest me how can I do this. Thanks Monali ANSWER: There is no API built into Android for wireless printing. You will need to contact the manufacturer ...
[ "android" ]
2
5
3,159
1
0
2011-05-31T13:09:17.203000
2011-05-31T13:16:47.967000
6,188,068
6,188,113
clearing form history with jQuery
Is there a way I can clear the form history with jQuery. I have a form and I can view the history of my input elements in a dropdown. I woz wondering If I can clear those input fields history with javascript or jQuery.
This should work: $("#field_id").attr("autocomplete", "off"); Or, on your html element:
clearing form history with jQuery Is there a way I can clear the form history with jQuery. I have a form and I can view the history of my input elements in a dropdown. I woz wondering If I can clear those input fields history with javascript or jQuery.
TITLE: clearing form history with jQuery QUESTION: Is there a way I can clear the form history with jQuery. I have a form and I can view the history of my input elements in a dropdown. I woz wondering If I can clear those input fields history with javascript or jQuery. ANSWER: This should work: $("#field_id").attr("a...
[ "javascript", "jquery", "html", "css" ]
3
2
2,916
2
0
2011-05-31T13:09:20.110000
2011-05-31T13:12:05.700000
6,188,069
6,189,268
Anybody know any resources for adding your own language to visual studio 2010 that is not managed?
I've seen the MyC pages in code project and MS's Iron Python. Is there a simple sample for unmanaged code? I'd like to add a superset to C++. Update Eventually the code may not be convertible to C++ and so I would like to find a start to finish example of creating an unmanaged new language for VS including IDE support,...
Visual Studio extensions are usually (at least for nontrivial extensions) implemented as packages by deriving from the Package class from the SDK. Your package class is responsible for defining all of the capabilities that it provides. You will need to implement a language service for IntelliSense, autocompletion, synt...
Anybody know any resources for adding your own language to visual studio 2010 that is not managed? I've seen the MyC pages in code project and MS's Iron Python. Is there a simple sample for unmanaged code? I'd like to add a superset to C++. Update Eventually the code may not be convertible to C++ and so I would like to...
TITLE: Anybody know any resources for adding your own language to visual studio 2010 that is not managed? QUESTION: I've seen the MyC pages in code project and MS's Iron Python. Is there a simple sample for unmanaged code? I'd like to add a superset to C++. Update Eventually the code may not be convertible to C++ and ...
[ "c++", "visual-studio", "visual-studio-2010", "vs-extensibility" ]
0
2
107
1
0
2011-05-31T13:09:21.360000
2011-05-31T14:38:46.130000
6,188,082
6,192,952
Alternative for python-mathdom
I'd like to convert a MathML expression to an equation string in python, for which the MathDOM module should be good for. An example would be: A B A B should map to "A + B". This should obviously work with more complex expressions. However, it is quite old and not working properly with new versions of the xml module (t...
Best solution so far: libsbml from libsbml import * ast = readMathMLFromString(xmlString) f = FunctionDefinition(2,4) f.setMath(ast) kl = KineticLaw(2,4) kl.setMath(f.getBody()) kl.getFormula() Ok for me since I'm already working with it but far from a general solution.
Alternative for python-mathdom I'd like to convert a MathML expression to an equation string in python, for which the MathDOM module should be good for. An example would be: A B A B should map to "A + B". This should obviously work with more complex expressions. However, it is quite old and not working properly with ne...
TITLE: Alternative for python-mathdom QUESTION: I'd like to convert a MathML expression to an equation string in python, for which the MathDOM module should be good for. An example would be: A B A B should map to "A + B". This should obviously work with more complex expressions. However, it is quite old and not workin...
[ "python", "mathml" ]
6
2
1,608
1
0
2011-05-31T13:10:02.500000
2011-05-31T20:08:15.833000
6,188,084
6,188,223
PHP Colour Every Box in the Middle
I have a list of boxes on my website: box1 box2 box3 box4 box5 box6 box7 box8 box9 Does anybody have a suggestion how to mark every box in the middle of the list (box2, box5, box8)? Thanks for your help! Here's my foreach loop: // other stuff here
Like so: $i = 0; foreach($boxes as $box){ if((($i+2) % 3) === 1){ //box2, box5, box8 } else{ //other boxes } $i++; }
PHP Colour Every Box in the Middle I have a list of boxes on my website: box1 box2 box3 box4 box5 box6 box7 box8 box9 Does anybody have a suggestion how to mark every box in the middle of the list (box2, box5, box8)? Thanks for your help! Here's my foreach loop: // other stuff here
TITLE: PHP Colour Every Box in the Middle QUESTION: I have a list of boxes on my website: box1 box2 box3 box4 box5 box6 box7 box8 box9 Does anybody have a suggestion how to mark every box in the middle of the list (box2, box5, box8)? Thanks for your help! Here's my foreach loop: // other stuff here ANSWER: Like so: $...
[ "php", "html" ]
2
1
125
4
0
2011-05-31T13:10:05.590000
2011-05-31T13:19:48.603000
6,188,106
6,188,698
REST/XML Api with Java
I am trying to provide a REST/XML Api programmed in Java. The application is given a parameter and will then return XML content via HTTP. In PHP the way I would solve it by having a rest_api.php file which is provided the parameter &string=helloworld by the application using my api, then I read this string, do calculat...
Two Java extensions work wonderfully in concert to this end: JAX-RS (reference implementation Jersey) JAXB (reference implementation Metro) Both are included with the Glassfish Java EE 5 and 6 reference implementation. In short, JAX-RS lets you declare a plain method as a web service by adding one of the @GET, @POST, @...
REST/XML Api with Java I am trying to provide a REST/XML Api programmed in Java. The application is given a parameter and will then return XML content via HTTP. In PHP the way I would solve it by having a rest_api.php file which is provided the parameter &string=helloworld by the application using my api, then I read t...
TITLE: REST/XML Api with Java QUESTION: I am trying to provide a REST/XML Api programmed in Java. The application is given a parameter and will then return XML content via HTTP. In PHP the way I would solve it by having a rest_api.php file which is provided the parameter &string=helloworld by the application using my ...
[ "java", "rest" ]
5
7
6,649
4
0
2011-05-31T13:11:42.820000
2011-05-31T13:57:51.593000
6,188,119
6,188,179
Where to keep html templates?
I have a single page app. Currently my templates stored in index.html e.g. Is it a best practice to store them in such way? I've found jQuery templates - where should I put them? but there is no acceptable answer.
You are doing it right. There is no need to add unnecessary complexity to a single-page app, according to the KISS principle: Most systems work best if they are kept simple rather than made complex; therefore simplicity should be a key goal in design and unnecessary complexity should be avoided.
Where to keep html templates? I have a single page app. Currently my templates stored in index.html e.g. Is it a best practice to store them in such way? I've found jQuery templates - where should I put them? but there is no acceptable answer.
TITLE: Where to keep html templates? QUESTION: I have a single page app. Currently my templates stored in index.html e.g. Is it a best practice to store them in such way? I've found jQuery templates - where should I put them? but there is no acceptable answer. ANSWER: You are doing it right. There is no need to add u...
[ "javascript", "html", "templates", "jquery-templates" ]
9
7
2,608
1
0
2011-05-31T13:12:20.643000
2011-05-31T13:15:56.290000
6,188,120
6,188,205
Best way to structure classes for accounts (Active Directory, Gmail, etc.) in C#
I'm starting to develop a set of classes to house account information. I need to perform CRUD operations on a number of different types of accounts (Active Directory, Google Apps, and others). I am trying to design the classes properly to start with so that they conform to OO principles and they are flexible for the fu...
I wouldn't put a find method in each type of user, objects should be unaware of their persistence. Instead why not treat things as a repository? You'd have something like IUserRepository public T Create() public T Load(object identifer); public void Save(T user); etc. And then have an interface for a base user; IUser p...
Best way to structure classes for accounts (Active Directory, Gmail, etc.) in C# I'm starting to develop a set of classes to house account information. I need to perform CRUD operations on a number of different types of accounts (Active Directory, Google Apps, and others). I am trying to design the classes properly to ...
TITLE: Best way to structure classes for accounts (Active Directory, Gmail, etc.) in C# QUESTION: I'm starting to develop a set of classes to house account information. I need to perform CRUD operations on a number of different types of accounts (Active Directory, Google Apps, and others). I am trying to design the cl...
[ "c#", "oop" ]
2
2
363
2
0
2011-05-31T13:12:20.923000
2011-05-31T13:18:24.930000
6,188,123
6,188,219
Node.js: Regex to make sure the string is the first in the line
How can I make sure that the string "To:" is at the beginning of the line and not at the middle or end? This is what I have: result.match(/To\:(.*)/)[1].replace(/^\s+/, '');
You want the ^ anchor, i.e. /^.../ Keep in mind that this matches the start-of-string, which is fine if you read line by line. In case you have multiple lines (i.e. newlines) in your string and you want to allow matches on any such line, use the m ("multi-line") modifier: /^.../m
Node.js: Regex to make sure the string is the first in the line How can I make sure that the string "To:" is at the beginning of the line and not at the middle or end? This is what I have: result.match(/To\:(.*)/)[1].replace(/^\s+/, '');
TITLE: Node.js: Regex to make sure the string is the first in the line QUESTION: How can I make sure that the string "To:" is at the beginning of the line and not at the middle or end? This is what I have: result.match(/To\:(.*)/)[1].replace(/^\s+/, ''); ANSWER: You want the ^ anchor, i.e. /^.../ Keep in mind that th...
[ "javascript", "regex" ]
0
2
571
1
0
2011-05-31T13:12:29.583000
2011-05-31T13:19:28.570000
6,188,126
6,188,595
Parameterized method with Ordering?
Now I am confused. I am quite new on Scala, having worked with it for a few weeks, I think I am getting familiar with it, but I am stuck on the apparently trivial following case. I cannot find the Scala equivalent to this Java declaration: public static > List myMethod(List values) { //... final List sorted = new Array...
That should be a context bound, as shown below. scala> def myMethod[A: Ordering](values: Seq[A]): Seq[A] = values.sorted myMethod: [A](values: Seq[A])(implicit evidence$1: Ordering[A])Seq[A]
Parameterized method with Ordering? Now I am confused. I am quite new on Scala, having worked with it for a few weeks, I think I am getting familiar with it, but I am stuck on the apparently trivial following case. I cannot find the Scala equivalent to this Java declaration: public static > List myMethod(List values) {...
TITLE: Parameterized method with Ordering? QUESTION: Now I am confused. I am quite new on Scala, having worked with it for a few weeks, I think I am getting familiar with it, but I am stuck on the apparently trivial following case. I cannot find the Scala equivalent to this Java declaration: public static > List myMet...
[ "scala", "variance", "type-parameter" ]
3
5
692
2
0
2011-05-31T13:12:41.037000
2011-05-31T13:49:23.043000
6,188,127
6,194,252
MVC 3.0 ViewModels - Id Field is being Forcefully Required, even though I do not mark it [Required]
I have a ViewModel setup like so.. class PropertyViewModel { Guid Id { get; set; } [Required] [Regex... ] string Name { get; set; } [Required] [Regex... ] string Description { get; set; } } This ought to work fine. The reason for the Id field is because the model binder needs to have knowledge of the ID for editing l...
The.NET type System.Guid can never be null. You need to change your property to: Guid? Id {get; set;} You can read more about System.Guid here: http://msdn.microsoft.com/en-us/library/system.type.guid.aspx and about nullable types here: http://msdn.microsoft.com/en-us/library/2cf62fcy.aspx
MVC 3.0 ViewModels - Id Field is being Forcefully Required, even though I do not mark it [Required] I have a ViewModel setup like so.. class PropertyViewModel { Guid Id { get; set; } [Required] [Regex... ] string Name { get; set; } [Required] [Regex... ] string Description { get; set; } } This ought to work fine. The...
TITLE: MVC 3.0 ViewModels - Id Field is being Forcefully Required, even though I do not mark it [Required] QUESTION: I have a ViewModel setup like so.. class PropertyViewModel { Guid Id { get; set; } [Required] [Regex... ] string Name { get; set; } [Required] [Regex... ] string Description { get; set; } } This ought...
[ "jquery", "asp.net-mvc-3", "jquery-validate" ]
0
2
631
1
0
2011-05-31T13:12:45.483000
2011-05-31T22:23:21.967000
6,188,128
6,189,034
Xcode 4 Organizer window does not show app built from the IDE
I am trying to get some files that were created by the app I am working on from my device, in which case I would simply click the Download button next to the app in the Organizer window. However, for some reason the app that I am building and running on the device from Xcode does not show up in the Organizer window. My...
I'm not sure what the problem with Organizer is but a workaround may be to use another tool like http://www.macroplant.com/iphoneexplorer/
Xcode 4 Organizer window does not show app built from the IDE I am trying to get some files that were created by the app I am working on from my device, in which case I would simply click the Download button next to the app in the Organizer window. However, for some reason the app that I am building and running on the ...
TITLE: Xcode 4 Organizer window does not show app built from the IDE QUESTION: I am trying to get some files that were created by the app I am working on from my device, in which case I would simply click the Download button next to the app in the Organizer window. However, for some reason the app that I am building a...
[ "ios4", "xcode4", "xcode-organizer" ]
2
4
880
1
0
2011-05-31T13:12:45.793000
2011-05-31T14:24:25.693000
6,188,131
6,188,255
MemoryStream from string - confusion about Encoding to use
I have a piece of code that converts string into memory stream: using (MemoryStream stream = new MemoryStream(Encoding.UTF8.GetBytes(applicationForm))) However I'm a bit confused if it's correct. Basically I'm always confused about.NET encoding. Bottom line: do I use correct encoding object ( UTF8 ) to get bytes? I kno...
Assuming applicationForm is a string you read from some UTF8 text file. It will be UTF16 / Unicode, whatever the encoding of the source file. The conversion happened when you loaded the file into the string. Your code will encode the applicationForm string into a MemoryStream of UTF8 bytes. This may or may not be corre...
MemoryStream from string - confusion about Encoding to use I have a piece of code that converts string into memory stream: using (MemoryStream stream = new MemoryStream(Encoding.UTF8.GetBytes(applicationForm))) However I'm a bit confused if it's correct. Basically I'm always confused about.NET encoding. Bottom line: do...
TITLE: MemoryStream from string - confusion about Encoding to use QUESTION: I have a piece of code that converts string into memory stream: using (MemoryStream stream = new MemoryStream(Encoding.UTF8.GetBytes(applicationForm))) However I'm a bit confused if it's correct. Basically I'm always confused about.NET encodin...
[ "c#", ".net", "encoding" ]
7
3
13,132
5
0
2011-05-31T13:12:55.830000
2011-05-31T13:23:12.280000
6,188,144
6,188,925
How to draw a table using System.Drawing
I would like to draw a table using System.Drawings, and then fill cells with some text. This text will change every few seconds, in various moments of time. It's a game, where there is a grid and every few seconds, random cell displays a number for a split of a second, then the user has to type the answer in the text b...
Have you considered using the DataGridView Control instead? If you prefer to use a more low-level approach, drawing a table is not that hard. Subdivide the x and y coordinates to obtain points for drawing ( System.Drawing.Point ) Draw lines using a pen ( System.Drawing.Pen ) and two points as arguments to Graphics.Draw...
How to draw a table using System.Drawing I would like to draw a table using System.Drawings, and then fill cells with some text. This text will change every few seconds, in various moments of time. It's a game, where there is a grid and every few seconds, random cell displays a number for a split of a second, then the ...
TITLE: How to draw a table using System.Drawing QUESTION: I would like to draw a table using System.Drawings, and then fill cells with some text. This text will change every few seconds, in various moments of time. It's a game, where there is a grid and every few seconds, random cell displays a number for a split of a...
[ "c#", "winforms", "system.drawing" ]
3
2
4,137
1
0
2011-05-31T13:13:41.097000
2011-05-31T14:15:42.353000
6,188,156
6,188,779
Problem loading taskbar icon for dialog
I am having a bit of a problem displaying the taskbar icon for a dialog that my app creates. The main application is a system tray based windows application. Here is the code I use to create the dialog: g_pMainWnd->m_DlgAuth= new CDlg_Auth(); g_pMainWnd->m_DlgAuth->SetTitle(_T("Authentication")); g_pMainWnd->m_DlgAuth-...
Just fixed it by using Sending WM_SETICON message to the main window instead of calling the seticon function
Problem loading taskbar icon for dialog I am having a bit of a problem displaying the taskbar icon for a dialog that my app creates. The main application is a system tray based windows application. Here is the code I use to create the dialog: g_pMainWnd->m_DlgAuth= new CDlg_Auth(); g_pMainWnd->m_DlgAuth->SetTitle(_T("A...
TITLE: Problem loading taskbar icon for dialog QUESTION: I am having a bit of a problem displaying the taskbar icon for a dialog that my app creates. The main application is a system tray based windows application. Here is the code I use to create the dialog: g_pMainWnd->m_DlgAuth= new CDlg_Auth(); g_pMainWnd->m_DlgAu...
[ "mfc", "visual-c++" ]
0
1
1,341
1
0
2011-05-31T13:14:18.507000
2011-05-31T14:03:51.867000
6,188,160
6,189,046
Migrating a complex branch hierarchy from SVN to Git
How can a large SVN repository (several GBs) with hundreds of branches be migrated to a Git repository? Not looking for them to work side by side, just a way to get rid of SVN. From some experiments I've done with git svn it's not clear how to specify a complex branch hierarchy. Especially when branches often get delet...
I've been looking at doing similar things with a different repo. The end result of my thinking and playing is that you need to do a few things: Use git filter-branch to do rewriting from some projects to another. IE, use git filter-branch to rename everything in a sub-directory to a parent. In my case, I have multiple ...
Migrating a complex branch hierarchy from SVN to Git How can a large SVN repository (several GBs) with hundreds of branches be migrated to a Git repository? Not looking for them to work side by side, just a way to get rid of SVN. From some experiments I've done with git svn it's not clear how to specify a complex branc...
TITLE: Migrating a complex branch hierarchy from SVN to Git QUESTION: How can a large SVN repository (several GBs) with hundreds of branches be migrated to a Git repository? Not looking for them to work side by side, just a way to get rid of SVN. From some experiments I've done with git svn it's not clear how to speci...
[ "svn", "git" ]
3
2
627
1
0
2011-05-31T13:14:29.270000
2011-05-31T14:24:51.310000
6,188,164
6,190,878
CRM 2011 - Given key was not present in dictionary - Update contact plugin
I'm trying to bind a plugin to the update contact event in Microsoft Dynamics CRM 2011. I've made a plugin and i already registered the assembly and step for my organisation. screenshot: CRM registration tool For this moment, i'm using sample code for my plugin. public class Plugin: IPlugin { public void Execute(IServi...
M.Medhat is absolutely correct, but let's expand on it a bit more so you understand. The first thing that you need to know is the difference between InputParameters vrs OutputParameters. A quick read at this MSDN article describing the difference between InputParameters and OutputParameters. Make sure to note this stat...
CRM 2011 - Given key was not present in dictionary - Update contact plugin I'm trying to bind a plugin to the update contact event in Microsoft Dynamics CRM 2011. I've made a plugin and i already registered the assembly and step for my organisation. screenshot: CRM registration tool For this moment, i'm using sample co...
TITLE: CRM 2011 - Given key was not present in dictionary - Update contact plugin QUESTION: I'm trying to bind a plugin to the update contact event in Microsoft Dynamics CRM 2011. I've made a plugin and i already registered the assembly and step for my organisation. screenshot: CRM registration tool For this moment, i...
[ "plugins", "crm", "dynamics-crm-2011" ]
0
2
10,201
3
0
2011-05-31T13:14:55.510000
2011-05-31T16:52:07.677000
6,188,172
6,189,543
R: split a data-frame, apply a function to all row-pairs in each subset
I am new to R and am trying to accomplish the following task efficiently. I have a data.frame, x, with columns: start, end, val1, val2, val3, val4. The columns are sorted/ordered by start. For each start, first I have to find all the entries in x that share the same start. Because the list is ordered, they will be cons...
As @Ben Bolker suggested, you can use the plyr package to do this compactly. The first step is to create a wider data-frame that contains the desired row-pairs. The row-pairs are generated using the combn function: set.seed(1) x <- data.frame( start = c(1,2,2,2,3,3,3,3), end = 1:8, v1 = sample(8), v2 = sample(8), v3 = ...
R: split a data-frame, apply a function to all row-pairs in each subset I am new to R and am trying to accomplish the following task efficiently. I have a data.frame, x, with columns: start, end, val1, val2, val3, val4. The columns are sorted/ordered by start. For each start, first I have to find all the entries in x t...
TITLE: R: split a data-frame, apply a function to all row-pairs in each subset QUESTION: I am new to R and am trying to accomplish the following task efficiently. I have a data.frame, x, with columns: start, end, val1, val2, val3, val4. The columns are sorted/ordered by start. For each start, first I have to find all ...
[ "r", "dataframe", "vectorization" ]
2
6
2,546
1
0
2011-05-31T13:15:28.707000
2011-05-31T14:59:24.070000
6,188,175
6,188,321
javascript - how to execute a simple GET webrequest?
How can I execute a simple webrequest in javascript. Such as var str = *whatever_comes_back_from*("search.php?term=hello");
You could use jQuery, or another javascript library, but instead of thinking of populating the variable then continueing with the script in a linear way, you should think in terms of a callback once the value is retrieved, because it can take a variable amount of time to retrieve the data. This event based architecture...
javascript - how to execute a simple GET webrequest? How can I execute a simple webrequest in javascript. Such as var str = *whatever_comes_back_from*("search.php?term=hello");
TITLE: javascript - how to execute a simple GET webrequest? QUESTION: How can I execute a simple webrequest in javascript. Such as var str = *whatever_comes_back_from*("search.php?term=hello"); ANSWER: You could use jQuery, or another javascript library, but instead of thinking of populating the variable then continu...
[ "javascript", "ajax" ]
1
2
5,542
2
0
2011-05-31T13:15:49.010000
2011-05-31T13:27:59.490000
6,188,178
6,188,253
objective c memory leak with array?
In my application i declare an array property, @property (nonatomic, retain) NSArray *listOfItems; and in my viewDidLoad method, listOfItems = [[NSArray alloc] initWithObjects:@"First", @"Second", nil]; I do not release the array in my viewDidLoad, because the objects in the array will be required elsewhere in the appl...
the retain will only 'kick in' when you do it like this self.listOfItems = [[NSArray alloc] initWithObjects:...]; Now, the retain count is indeed 2. If you leave self out, it will just be one. There is a distinct difference in calling 'set' and just assigning. To answer your original question; your code is not leaking.
objective c memory leak with array? In my application i declare an array property, @property (nonatomic, retain) NSArray *listOfItems; and in my viewDidLoad method, listOfItems = [[NSArray alloc] initWithObjects:@"First", @"Second", nil]; I do not release the array in my viewDidLoad, because the objects in the array wi...
TITLE: objective c memory leak with array? QUESTION: In my application i declare an array property, @property (nonatomic, retain) NSArray *listOfItems; and in my viewDidLoad method, listOfItems = [[NSArray alloc] initWithObjects:@"First", @"Second", nil]; I do not release the array in my viewDidLoad, because the objec...
[ "objective-c", "memory-leaks" ]
1
1
250
6
0
2011-05-31T13:15:55.883000
2011-05-31T13:22:53.453000
6,188,184
6,195,844
How can I use a permalink containing a slash in a named route in Rails 3?
I followed Ryan Bates screencast of how to use permalinks in a Rails application. Unfortunately I am stuck with an issue when some of my permalinks contain slashes. Is there anything that I can do in the controller to encode those on the fly, or do they need to be encoded in the database?
You can use Rack::Utils.escape to return a clean, friendly URI. For instance: Rack::Utils.escape("This/is/not/a/good/url") will return "This%2Fis%2Fnot%2Fa%2Fgood%2Furl" and Rack::Utils.unescape("This%2Fis%2Fnot%2Fa%2Fgood%2Furl") converts it back to the original string: "This%2Fis%2Fnot%2Fa%2Fgood%2Furl" You'll have t...
How can I use a permalink containing a slash in a named route in Rails 3? I followed Ryan Bates screencast of how to use permalinks in a Rails application. Unfortunately I am stuck with an issue when some of my permalinks contain slashes. Is there anything that I can do in the controller to encode those on the fly, or ...
TITLE: How can I use a permalink containing a slash in a named route in Rails 3? QUESTION: I followed Ryan Bates screencast of how to use permalinks in a Rails application. Unfortunately I am stuck with an issue when some of my permalinks contain slashes. Is there anything that I can do in the controller to encode tho...
[ "ruby-on-rails-3" ]
1
2
140
1
0
2011-05-31T13:16:41.223000
2011-06-01T03:08:45
6,188,188
6,189,277
Adding new property to each document in a large collection
Using the mongodb shell, I'm trying to add a new property to each document in a large collection. The collection (Listing) has an existing property called Address. I'm simply trying to add a new property called LowerCaseAddress which can be used for searching so that I don't need to use a case-insensitive regex for add...
you JavaScript didn't work, but the code below works. But don't knew how long it takes for 4 Million records. db.Listing.find().forEach(function(item){ db.Listing.update({_id: item._id}, {$set: { LowerCaseAddress: item.Address.toLowerCase() }}) })
Adding new property to each document in a large collection Using the mongodb shell, I'm trying to add a new property to each document in a large collection. The collection (Listing) has an existing property called Address. I'm simply trying to add a new property called LowerCaseAddress which can be used for searching s...
TITLE: Adding new property to each document in a large collection QUESTION: Using the mongodb shell, I'm trying to add a new property to each document in a large collection. The collection (Listing) has an existing property called Address. I'm simply trying to add a new property called LowerCaseAddress which can be us...
[ "mongodb", "mongodb-.net-driver", "mongo-shell" ]
11
24
14,113
2
0
2011-05-31T13:16:54.260000
2011-05-31T14:39:36.690000
6,188,189
6,196,072
count the number of words in a xml node using xsl
Here is the sample xml document. count the number of words For this example I want to count the number of words in the node "" in xslt. The output like be Number of words:: 5 Any idea for this? Your (Dimitre Novatchev) code is working fine for the above xml. Is your code will work for the following xml? pass pass fail ...
Use this XPath one-liner: string-length(normalize-space(node)) - string-length(translate(normalize-space(node),' ','')) +1 Here is a short verification using XSLT: When this transformation is applied on the provided XML document: count the number of words the wanted, correct result is produced: 5 Explanation: Use of th...
count the number of words in a xml node using xsl Here is the sample xml document. count the number of words For this example I want to count the number of words in the node "" in xslt. The output like be Number of words:: 5 Any idea for this? Your (Dimitre Novatchev) code is working fine for the above xml. Is your cod...
TITLE: count the number of words in a xml node using xsl QUESTION: Here is the sample xml document. count the number of words For this example I want to count the number of words in the node "" in xslt. The output like be Number of words:: 5 Any idea for this? Your (Dimitre Novatchev) code is working fine for the abov...
[ "xml", "xslt" ]
6
11
8,972
3
0
2011-05-31T13:16:58.240000
2011-06-01T03:51:37.727000
6,188,195
6,188,893
Multiple Joins Mysql Doubles SUM values
Im trying to make a a query, but its doubling the Sum values SELECT cidades.id AS id, cidades.name AS municipio, Sum(conjuntos.n_uhs) AS uh, programas.id AS programa, conjuntos.name FROM conjuntos Inner Join conjuntos_programas ON conjuntos_programas.conjunto_id = conjuntos.id Inner Join programas ON programas.id = con...
You've got duplicate rows, you can check this by removing the group by and the SUM(... from your query. Change the query as follows and tell me if that fixes to problem. SELECT DISTINCT cidades.id AS id, cidades.name AS municipio, SUM(conjuntos.n_uhs) AS uh, programas.id AS programa, conjuntos.name FROM conjuntos INNER...
Multiple Joins Mysql Doubles SUM values Im trying to make a a query, but its doubling the Sum values SELECT cidades.id AS id, cidades.name AS municipio, Sum(conjuntos.n_uhs) AS uh, programas.id AS programa, conjuntos.name FROM conjuntos Inner Join conjuntos_programas ON conjuntos_programas.conjunto_id = conjuntos.id In...
TITLE: Multiple Joins Mysql Doubles SUM values QUESTION: Im trying to make a a query, but its doubling the Sum values SELECT cidades.id AS id, cidades.name AS municipio, Sum(conjuntos.n_uhs) AS uh, programas.id AS programa, conjuntos.name FROM conjuntos Inner Join conjuntos_programas ON conjuntos_programas.conjunto_id...
[ "mysql", "join", "subquery", "sum" ]
0
2
1,160
2
0
2011-05-31T13:17:32.687000
2011-05-31T14:13:01.270000
6,188,197
6,188,256
Problem Storing Latitude and Longitude values in MySQL database
I want to store the values of latitude and longitude fetched from Google Maps GeoCoding API in a MySQL database. The values are in float format. 12.9274529 77.5905970 And when I want to store it in database (which is datatype float) it rounds up float and store it in following format: 12.9275 77.5906 Am I using the wro...
You need to use decimal if you don't want the numbers to be approximated. Fixed-Point (Exact-Value) Types The DECIMAL and NUMERIC types store exact numeric data values. These types are used when it is important to preserve exact precision, for example with monetary data. And now the "here you go" answer: Use DECIMAL(10...
Problem Storing Latitude and Longitude values in MySQL database I want to store the values of latitude and longitude fetched from Google Maps GeoCoding API in a MySQL database. The values are in float format. 12.9274529 77.5905970 And when I want to store it in database (which is datatype float) it rounds up float and ...
TITLE: Problem Storing Latitude and Longitude values in MySQL database QUESTION: I want to store the values of latitude and longitude fetched from Google Maps GeoCoding API in a MySQL database. The values are in float format. 12.9274529 77.5905970 And when I want to store it in database (which is datatype float) it ro...
[ "php", "mysql", "types", "floating-point" ]
17
40
28,304
7
0
2011-05-31T13:17:39.703000
2011-05-31T13:23:15.603000
6,188,201
6,188,259
Override ASP.NET Authorization annotations
Is there a way to override Authorize annotation in ASP.Net? I'm using MVC and my controller is annotated with: [Authorize(Roles="Admin")] The majority of actions in this controller are restricted to Admin users. I would like to override one action method so that it becomes available to all users: [HttpPost] [Authorize(...
I think you should be able to achieve what you are trying to do by simply removing the attribute from controller and move it to methods only where needed.
Override ASP.NET Authorization annotations Is there a way to override Authorize annotation in ASP.Net? I'm using MVC and my controller is annotated with: [Authorize(Roles="Admin")] The majority of actions in this controller are restricted to Admin users. I would like to override one action method so that it becomes ava...
TITLE: Override ASP.NET Authorization annotations QUESTION: Is there a way to override Authorize annotation in ASP.Net? I'm using MVC and my controller is annotated with: [Authorize(Roles="Admin")] The majority of actions in this controller are restricted to Admin users. I would like to override one action method so t...
[ "c#", ".net", "asp.net", "asp.net-mvc", "security" ]
0
6
2,295
2
0
2011-05-31T13:17:56.973000
2011-05-31T13:23:25.743000
6,188,211
6,189,200
Delete all the lines in a file that contains a specific character
I want to delete all the rows/lines in a file that has a specific character, '?' in my case. I hope there is a single line command in Bash or AWK or Perl. Thanks
Here are already grep, sed and perl solutions - only for fun, pure bash one: pattern='?' while read line do [[ "$line" =~ "$pattern" ]] || echo "$line" done translated for every line on the STDIN match it for the pattern =~ and if the match is not successful || - print out the line
Delete all the lines in a file that contains a specific character I want to delete all the rows/lines in a file that has a specific character, '?' in my case. I hope there is a single line command in Bash or AWK or Perl. Thanks
TITLE: Delete all the lines in a file that contains a specific character QUESTION: I want to delete all the rows/lines in a file that has a specific character, '?' in my case. I hope there is a single line command in Bash or AWK or Perl. Thanks ANSWER: Here are already grep, sed and perl solutions - only for fun, pur...
[ "perl", "bash", "unix", "command-line", "awk" ]
3
2
11,770
5
0
2011-05-31T13:19:04.513000
2011-05-31T14:34:24.540000
6,188,218
6,220,529
integrate wordnet with solr
I am trying to integrate wordnet api in to Apache solr. But it is not seems to be working and there is no good documentation as well. Could you please post me the steps if any body has experience on it?
There are more than one way to do this: 1) https://issues.apache.org/jira/browse/LUCENE-2347 2) https://gist.github.com/562776 These are simple Java classes, which extract the synonyms from WordNet's prolog file - more or less the same way. Hope this helps. Péter
integrate wordnet with solr I am trying to integrate wordnet api in to Apache solr. But it is not seems to be working and there is no good documentation as well. Could you please post me the steps if any body has experience on it?
TITLE: integrate wordnet with solr QUESTION: I am trying to integrate wordnet api in to Apache solr. But it is not seems to be working and there is no good documentation as well. Could you please post me the steps if any body has experience on it? ANSWER: There are more than one way to do this: 1) https://issues.apac...
[ "lucene", "solr", "wordnet" ]
1
2
2,133
1
0
2011-05-31T13:19:27.100000
2011-06-02T21:19:36.913000
6,188,231
6,189,346
How to implement configuration data for a vsix extension in Visual Studio 2010?
I'm currently implementing a vsix extension tool window which will soon need a database connection string for querying some data to display to the developer in the tool window. I'd like to make this connection string configurable by the developer. As the developer is unlikely to change the config settings often a file ...
The best place to store settings for a.vsix extension is to use a.settings file. In order to create one do the following Right Click on the project and select "Properties" Go to the Settings Tab Click on the link to create a default settings file This will create a couple of files in your solution. Settings.settings Se...
How to implement configuration data for a vsix extension in Visual Studio 2010? I'm currently implementing a vsix extension tool window which will soon need a database connection string for querying some data to display to the developer in the tool window. I'd like to make this connection string configurable by the dev...
TITLE: How to implement configuration data for a vsix extension in Visual Studio 2010? QUESTION: I'm currently implementing a vsix extension tool window which will soon need a database connection string for querying some data to display to the developer in the tool window. I'd like to make this connection string confi...
[ "visual-studio", "visual-studio-2010", "vsix" ]
1
3
6,276
2
0
2011-05-31T13:20:29.910000
2011-05-31T14:44:38.983000
6,188,248
6,188,485
Extjs treePanel node scope problem
I have yet another problem with extjs. When I build treeview I can't get the scope to work with the tree nodes. The scope of root node is my js object as opposed to treenode which returns window as the scope. Any idea why? TreePanel Definition: this.treeForParamPanel= new Ext.tree.TreePanel( { layout: 'fit', frame:true...
When using TreePanel 's I normally put the click event on the treepanel and not on each of the nodes. If you don't need the click event to be handled differently for each node, put the click event on the treepanel like this: this.treeForParamPanel = new Ext.tree.TreePanel( {... your parameters... listeners: { click: fu...
Extjs treePanel node scope problem I have yet another problem with extjs. When I build treeview I can't get the scope to work with the tree nodes. The scope of root node is my js object as opposed to treenode which returns window as the scope. Any idea why? TreePanel Definition: this.treeForParamPanel= new Ext.tree.Tre...
TITLE: Extjs treePanel node scope problem QUESTION: I have yet another problem with extjs. When I build treeview I can't get the scope to work with the tree nodes. The scope of root node is my js object as opposed to treenode which returns window as the scope. Any idea why? TreePanel Definition: this.treeForParamPanel...
[ "extjs", "treeview", "scope", "treenode" ]
1
2
1,499
1
0
2011-05-31T13:21:59.657000
2011-05-31T13:41:09.880000
6,188,266
6,188,547
ASP.NET Detect SVG Capability Server Side
Is there a way to detect whether or not a browser has SVG capability server side? I know how to do this on the client, but I'd like to detect it on the browser.
Server-side browser detection or capability detection is notoriously prone to error. The only visibility you have at the server of what browser the user has is the user agent string. Unfortunately, this is completely unreliable, as it can be spoofed by the client. It is also often blanked out for privacy reasons by var...
ASP.NET Detect SVG Capability Server Side Is there a way to detect whether or not a browser has SVG capability server side? I know how to do this on the client, but I'd like to detect it on the browser.
TITLE: ASP.NET Detect SVG Capability Server Side QUESTION: Is there a way to detect whether or not a browser has SVG capability server side? I know how to do this on the client, but I'd like to detect it on the browser. ANSWER: Server-side browser detection or capability detection is notoriously prone to error. The o...
[ ".net", "asp.net", "svg" ]
2
3
492
1
0
2011-05-31T13:24:05.787000
2011-05-31T13:46:09.847000