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,196,065
6,196,078
How to erase elements in a map with the elements keys in a set?
I have a set stores the keys which I want to delete in a map. I tried the code blow, but it didn't compile. std::set keys; std::map mymap;.... for_each(keys.begin(), keys.end(), boost::bind(&std::map::erase, &mymap, _1));
You cannot take the address of a Standard Library member function because the declarations of such member functions are unspecified (an implementation is permitted to add additional, optional parameters or add additional overloads to otherwise non-overloaded member functions, so long as the behavior is the same). The e...
How to erase elements in a map with the elements keys in a set? I have a set stores the keys which I want to delete in a map. I tried the code blow, but it didn't compile. std::set keys; std::map mymap;.... for_each(keys.begin(), keys.end(), boost::bind(&std::map::erase, &mymap, _1));
TITLE: How to erase elements in a map with the elements keys in a set? QUESTION: I have a set stores the keys which I want to delete in a map. I tried the code blow, but it didn't compile. std::set keys; std::map mymap;.... for_each(keys.begin(), keys.end(), boost::bind(&std::map::erase, &mymap, _1)); ANSWER: You can...
[ "c++", "stl", "dictionary", "set", "function-pointers" ]
2
7
1,819
1
0
2011-06-01T03:49:45.200000
2011-06-01T03:52:44.967000
6,196,073
6,196,109
Entity Framework 4.1 - Swapping Databases
From everything I have read, EntityFramework is supposed to be the bees knees, that You can use CodeFirst to generate entities from POCO's. Awesome! I've done this, I let the EntityFramework default behavior do its thing, and now I'm stuck with my back against the wall. Everything I have read about EntityFramework and ...
Here is an example i do using an SQLite DB to dynamically change the path... same logic can be taken for any SQL. I put this in my application.xaml of my WPF app (so prob put in your application_start) ' Application-level events, such as Startup, Exit, and DispatcherUnhandledException ' can be handled in this file. Pu...
Entity Framework 4.1 - Swapping Databases From everything I have read, EntityFramework is supposed to be the bees knees, that You can use CodeFirst to generate entities from POCO's. Awesome! I've done this, I let the EntityFramework default behavior do its thing, and now I'm stuck with my back against the wall. Everyth...
TITLE: Entity Framework 4.1 - Swapping Databases QUESTION: From everything I have read, EntityFramework is supposed to be the bees knees, that You can use CodeFirst to generate entities from POCO's. Awesome! I've done this, I let the EntityFramework default behavior do its thing, and now I'm stuck with my back against...
[ "database", "entity-framework-4.1" ]
2
1
440
2
0
2011-06-01T03:52:02.703000
2011-06-01T03:57:51.083000
6,196,079
6,196,083
Relative paths with Master Pages are confusing me
I used Visual Studio 2010 to create a new project based on the Web Application template. I changed nothing. Note that Login.aspx and Default.aspx both reference the same Site.Master master page in the website root folder. And the Site.Master refers to the CSS sheet using a relative URL "~/Styles/Site.css" Doesn't the t...
No. The tilde refers to the root folder of the web application. If you want your current location, use./ or simply omit the ~/ altogether. But in this case, it just refers to your project.
Relative paths with Master Pages are confusing me I used Visual Studio 2010 to create a new project based on the Web Application template. I changed nothing. Note that Login.aspx and Default.aspx both reference the same Site.Master master page in the website root folder. And the Site.Master refers to the CSS sheet usin...
TITLE: Relative paths with Master Pages are confusing me QUESTION: I used Visual Studio 2010 to create a new project based on the Web Application template. I changed nothing. Note that Login.aspx and Default.aspx both reference the same Site.Master master page in the website root folder. And the Site.Master refers to ...
[ "asp.net", "css", "visual-studio-2010" ]
2
2
2,269
3
0
2011-06-01T03:52:58.397000
2011-06-01T03:54:29.410000
6,196,096
6,196,352
Multiple instances of usercontrol on one page but only the last control is being referenced
I have a UserControl that allows the user to upload files and also displays them in a GridView. On the parent page, I have a jQuery tab control to which I dynamically add 2 instances of my UserControl (on different tabs). The second instance works fine, so I know the control works. However, when I try to upload a file ...
Check the actual html and javascript rendered to the client to ensure that there isn't a duplicate ID related to the controls slipping through the cracks.
Multiple instances of usercontrol on one page but only the last control is being referenced I have a UserControl that allows the user to upload files and also displays them in a GridView. On the parent page, I have a jQuery tab control to which I dynamically add 2 instances of my UserControl (on different tabs). The se...
TITLE: Multiple instances of usercontrol on one page but only the last control is being referenced QUESTION: I have a UserControl that allows the user to upload files and also displays them in a GridView. On the parent page, I have a jQuery tab control to which I dynamically add 2 instances of my UserControl (on diffe...
[ "c#", "jquery", "asp.net" ]
0
1
4,463
2
0
2011-06-01T03:56:13.357000
2011-06-01T04:40:11.323000
6,196,100
6,273,041
Creating an action based on countdown
imagine that you had a task that finished in, say 10 seconds. Now, after the 10 seconds pass, the user has to be redirected back to a specific page with the results of that task. This redirection has to happen, even if the user is viewing another page. As you can imagine, there is a start and end time in the model that...
It sounds like your design is ok. Depending on your requirements, you might be able to skip the redirect by rendering the view right away and then setting the correct url using javascript. Here is information on how to do that: How does GitHub change the URL but not the reload?.
Creating an action based on countdown imagine that you had a task that finished in, say 10 seconds. Now, after the 10 seconds pass, the user has to be redirected back to a specific page with the results of that task. This redirection has to happen, even if the user is viewing another page. As you can imagine, there is ...
TITLE: Creating an action based on countdown QUESTION: imagine that you had a task that finished in, say 10 seconds. Now, after the 10 seconds pass, the user has to be redirected back to a specific page with the results of that task. This redirection has to happen, even if the user is viewing another page. As you can ...
[ "ruby-on-rails" ]
2
1
165
1
0
2011-06-01T03:56:38.507000
2011-06-08T00:27:04.417000
6,196,108
6,196,118
C++ assign element of a string to a new string
Im trying to assign a piece of a string, to a new string variable. Now Im pretty new so longer, but easier to understand explanations are the best for me. Anyways, how Im trying to do it is like this: string test = "384239572"; string u = test[4]; The full code of what im trying to do is this: #include #include #includ...
You can use one of the string constructors string u(1,test[4]); EDIT: The 1 indicates the number of times to repeat the character test[4] In your code you are trying to assign a char to a string object.
C++ assign element of a string to a new string Im trying to assign a piece of a string, to a new string variable. Now Im pretty new so longer, but easier to understand explanations are the best for me. Anyways, how Im trying to do it is like this: string test = "384239572"; string u = test[4]; The full code of what im ...
TITLE: C++ assign element of a string to a new string QUESTION: Im trying to assign a piece of a string, to a new string variable. Now Im pretty new so longer, but easier to understand explanations are the best for me. Anyways, how Im trying to do it is like this: string test = "384239572"; string u = test[4]; The ful...
[ "c++", "string" ]
0
3
232
3
0
2011-06-01T03:57:47.617000
2011-06-01T03:59:54.340000
6,196,110
6,196,253
"Variable Assignment Request" Object Design
I have multiple classes that are not allowed to modify each other's fields, but instead must request to modify by adding a request object to the Main class's queue. The Main class, at the end of each loop, will perform the requested modifications. public class Main { public static ClassA a = new ClassA(); public stati...
Maybe this doesn't apply for your use case, but you could have the objects themself keep track of pending modifications, and then have a call, made from your main class, that modifies the actual fields themself. If you only need the set operation, keeping track of modifications is as easy as keeping an extra field for ...
"Variable Assignment Request" Object Design I have multiple classes that are not allowed to modify each other's fields, but instead must request to modify by adding a request object to the Main class's queue. The Main class, at the end of each loop, will perform the requested modifications. public class Main { public ...
TITLE: "Variable Assignment Request" Object Design QUESTION: I have multiple classes that are not allowed to modify each other's fields, but instead must request to modify by adding a request object to the Main class's queue. The Main class, at the end of each loop, will perform the requested modifications. public cla...
[ "java" ]
3
1
183
3
0
2011-06-01T03:58:05.263000
2011-06-01T04:23:59.803000
6,196,112
6,196,316
How to use LookUp tables in oracle?
In my database, many tables have the 'State' field, representing the state that, that particular entity falls in. I have been told that we should use Lookup tables for this kind of thing, but I am unsure of the exact mechanism. Can someone clarify these points? How is the integrity maintained? (i.e. how do I make sure ...
1 - Integrity is maintained using what is called a FOREIGN KEY constraint. A reasonable scenario might have you do these two tables: Table Name: STATE_CODE ID DESCRIPTION ================= 1 Alabama 2 Arkansas... 50 Wyoming Table Name: CUSTOMER ===================== CUST_ID CUST_NAME CUST_STATE 100 AAA Company 1 --the...
How to use LookUp tables in oracle? In my database, many tables have the 'State' field, representing the state that, that particular entity falls in. I have been told that we should use Lookup tables for this kind of thing, but I am unsure of the exact mechanism. Can someone clarify these points? How is the integrity m...
TITLE: How to use LookUp tables in oracle? QUESTION: In my database, many tables have the 'State' field, representing the state that, that particular entity falls in. I have been told that we should use Lookup tables for this kind of thing, but I am unsure of the exact mechanism. Can someone clarify these points? How ...
[ "sql", "oracle", "lookup-tables" ]
5
7
27,504
2
0
2011-06-01T03:58:33.047000
2011-06-01T04:34:04.070000
6,196,114
6,196,215
SendEmail method not working
I'm writing an application which sends a lot of emails throughout the app's lifecycle. The users complained that the application was really unresponsive and generally slow. The only thing I could come up with as the reason, was the heavy email sending. So I thought I could solve the problem by sending the emails in a d...
I suspect you're better off using MailMessage Class (System.Net.Mail) MailMessage mess = new MailMessage( SPContext.Current.Site.WebApplication.OutboundMailReplyToAddress, sendTo, subject, message); mess.IsBodyHtml = true; SmtpClient smtp = new SmtpClient( SPContext.Current.Site.WebApplication.OutboundMailServiceInstan...
SendEmail method not working I'm writing an application which sends a lot of emails throughout the app's lifecycle. The users complained that the application was really unresponsive and generally slow. The only thing I could come up with as the reason, was the heavy email sending. So I thought I could solve the problem...
TITLE: SendEmail method not working QUESTION: I'm writing an application which sends a lot of emails throughout the app's lifecycle. The users complained that the application was really unresponsive and generally slow. The only thing I could come up with as the reason, was the heavy email sending. So I thought I could...
[ "c#", "sharepoint", "sharepoint-2007" ]
1
5
3,432
5
0
2011-06-01T03:58:47.007000
2011-06-01T04:16:44.190000
6,196,117
6,196,138
Combine 3 FQL in a single query - Facebook PHP
current i'm doing this FQL to get user info Please help me combing all the query into one [ i want to get all the info in 4 arrays by writing a single FQL ]! $pics=array(); $ids=array(); $names=array(); $sexs=array(); $i=0; $fql = "SELECT uid FROM user WHERE uid IN (SELECT uid2 FROM friend WHERE uid1 = me()) "; $fUIDS...
Without any particular knowledge of FQL, I would hazard this guess; it seems to be SQL and you can normally just specify more than one field at a time... $pics = array(); $ids = array(); $names = array(); $sexs = array(); $fql = 'SELECT uid, name, pic_square, sex FROM user WHERE uid IN (SELECT uid2 FROM friend WHERE u...
Combine 3 FQL in a single query - Facebook PHP current i'm doing this FQL to get user info Please help me combing all the query into one [ i want to get all the info in 4 arrays by writing a single FQL ]! $pics=array(); $ids=array(); $names=array(); $sexs=array(); $i=0; $fql = "SELECT uid FROM user WHERE uid IN (SELEC...
TITLE: Combine 3 FQL in a single query - Facebook PHP QUESTION: current i'm doing this FQL to get user info Please help me combing all the query into one [ i want to get all the info in 4 arrays by writing a single FQL ]! $pics=array(); $ids=array(); $names=array(); $sexs=array(); $i=0; $fql = "SELECT uid FROM user W...
[ "php", "facebook", "fql.multiquery" ]
0
1
1,860
2
0
2011-06-01T03:59:47.427000
2011-06-01T04:04:35.727000
6,196,122
6,204,551
Lua Copas, help clarifying how to handle multiple users
I'm a bit confused and think it's going to be an easy answer but my searches aren't helping me much:( I want to be able to do an skt:send anywhere. I could send it into OutToUser function as a parameter but I'm going to have a lot of different places I'll want to do this at and feel that will get too messy. I tried sto...
You can define OutToUser in the scope of the handler: function Server:init() local function handler(skt, host, port) --make the function local to here local function OutToUser(data) --references the skt variable in the enclosing scope --(the handler function) skt:send(data.. "\r\n") end while true do data = skt:recei...
Lua Copas, help clarifying how to handle multiple users I'm a bit confused and think it's going to be an easy answer but my searches aren't helping me much:( I want to be able to do an skt:send anywhere. I could send it into OutToUser function as a parameter but I'm going to have a lot of different places I'll want to ...
TITLE: Lua Copas, help clarifying how to handle multiple users QUESTION: I'm a bit confused and think it's going to be an easy answer but my searches aren't helping me much:( I want to be able to do an skt:send anywhere. I could send it into OutToUser function as a parameter but I'm going to have a lot of different pl...
[ "scope", "lua" ]
1
1
677
2
0
2011-06-01T04:02:06.480000
2011-06-01T16:28:37.150000
6,196,125
6,196,174
When returning an object, why put the creation+initialization and the return as two seperate statements instead of one?
Example: Foo make_foo(int a1, int a2){ Foo f(a1,a2); return f; } Having seen such functions several times, is it just a matter of coding style / preference or is there more to it than meets the eye? Specifically this answer got me thinking with the make_unique implementation and the claim it is exception safe - is that...
Note that the answer to which you refer actually has something different: std::unique_ptr ret (new T(std::forward (args)...)); In this line of code, explicit dynamic allocation is performed. Best practices dictate that whenever you perform explicit dynamic allocation, you should immediately assign the result to a named...
When returning an object, why put the creation+initialization and the return as two seperate statements instead of one? Example: Foo make_foo(int a1, int a2){ Foo f(a1,a2); return f; } Having seen such functions several times, is it just a matter of coding style / preference or is there more to it than meets the eye? S...
TITLE: When returning an object, why put the creation+initialization and the return as two seperate statements instead of one? QUESTION: Example: Foo make_foo(int a1, int a2){ Foo f(a1,a2); return f; } Having seen such functions several times, is it just a matter of coding style / preference or is there more to it tha...
[ "c++", "return", "instantiation", "creation" ]
3
4
179
5
0
2011-06-01T04:02:41.607000
2011-06-01T04:10:58.950000
6,196,128
6,207,007
Pattern Matching Python
I'm currently stuck on trying to make a naive algorithm which given a piece of a pattern e.g aabba search for it in a text e.g abbbbaababaabbaaabbaa one letter at a time. It will compare a with the text if that is right then compares the next letter and if that's wrong the whole pattern will shift one and compare a wit...
I guess here's what you need, the following code does character-by-character comparison. You may also replace the calls to find by iterations over text which includes checks whether the first character of text matches the first character of pattern: def my_find(text, pattern): '''Find the start index of a pattern strin...
Pattern Matching Python I'm currently stuck on trying to make a naive algorithm which given a piece of a pattern e.g aabba search for it in a text e.g abbbbaababaabbaaabbaa one letter at a time. It will compare a with the text if that is right then compares the next letter and if that's wrong the whole pattern will shi...
TITLE: Pattern Matching Python QUESTION: I'm currently stuck on trying to make a naive algorithm which given a piece of a pattern e.g aabba search for it in a text e.g abbbbaababaabbaaabbaa one letter at a time. It will compare a with the text if that is right then compares the next letter and if that's wrong the whol...
[ "python" ]
1
1
2,779
3
0
2011-06-01T04:02:57.800000
2011-06-01T20:06:15.600000
6,196,136
6,197,775
readData for 24-bit FLAC and WAV files
I used readData successfully to read 16-bit audio files and generate peak files for wave form display. However, I'm having some trouble interpreting PCM values for 24-bit FLAC and WAV files. First, what is the block size for 24-bit? 16-bit signed values ranges from -32768 to +32768 and 24-bit ranges from -8388607 to +8...
24 bit audio files have a block align of 3 * number of channels. Why not go for 100ms of audio: int blockSize = 3 * channels * (sampleRate / 10); This will work fine for 24 bit WAV. Whether or not your FLAC reader lets you read out to that granularity depends on its internal implementation.
readData for 24-bit FLAC and WAV files I used readData successfully to read 16-bit audio files and generate peak files for wave form display. However, I'm having some trouble interpreting PCM values for 24-bit FLAC and WAV files. First, what is the block size for 24-bit? 16-bit signed values ranges from -32768 to +3276...
TITLE: readData for 24-bit FLAC and WAV files QUESTION: I used readData successfully to read 16-bit audio files and generate peak files for wave form display. However, I'm having some trouble interpreting PCM values for 24-bit FLAC and WAV files. First, what is the block size for 24-bit? 16-bit signed values ranges fr...
[ "c#", "audio", "io", "fmod" ]
1
1
4,150
1
0
2011-06-01T04:03:48.377000
2011-06-01T07:38:50.537000
6,196,141
6,196,200
oracle: decode and subquery select result
I have a oracle query and part of it is calculating some value using DECODE. For example: SELECT..., (SELECT DECODE((SELECT 23 FROM DUAL), 0, null, (SELECT 23 FROM DUAL)) FROM DUAL) FROM... Here the value "23" gets calculated at runtime, and it's quite complicated joins - multiple tables, uses PARTITION BY etc. So I wa...
Will this work for you? I've just moved the "23" to an inline table with a descriptive alias. select..., ( select decode ( computed_value.val, 0, null, computed_value.val ) from (select 23 as val from dual) computed_value ) from... A CASE statement might also add clarity, as in: select...,case when computed_value.val =...
oracle: decode and subquery select result I have a oracle query and part of it is calculating some value using DECODE. For example: SELECT..., (SELECT DECODE((SELECT 23 FROM DUAL), 0, null, (SELECT 23 FROM DUAL)) FROM DUAL) FROM... Here the value "23" gets calculated at runtime, and it's quite complicated joins - multi...
TITLE: oracle: decode and subquery select result QUESTION: I have a oracle query and part of it is calculating some value using DECODE. For example: SELECT..., (SELECT DECODE((SELECT 23 FROM DUAL), 0, null, (SELECT 23 FROM DUAL)) FROM DUAL) FROM... Here the value "23" gets calculated at runtime, and it's quite complic...
[ "sql", "oracle", "subquery", "decode" ]
7
10
55,233
5
0
2011-06-01T04:04:51.767000
2011-06-01T04:15:15.150000
6,196,144
6,196,684
Communication between Flash and Java/C# server based app
For example, Flash records voice and sends it to the server where Java or C# apps can proccess it and return back some data (or write it to db). How this communication possible, which protocols sould be used and etc.
You just have a server socket in java or C/C++/C# whatever, use the flash Socket class to connect to the open socket on the server and do your transactions through that socket. http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/Socket.html http://help.adobe.com/en_US/as3/dev/WS5b3ccc516d4fbf35...
Communication between Flash and Java/C# server based app For example, Flash records voice and sends it to the server where Java or C# apps can proccess it and return back some data (or write it to db). How this communication possible, which protocols sould be used and etc.
TITLE: Communication between Flash and Java/C# server based app QUESTION: For example, Flash records voice and sends it to the server where Java or C# apps can proccess it and return back some data (or write it to db). How this communication possible, which protocols sould be used and etc. ANSWER: You just have a ser...
[ "c#", "java", "flash", "actionscript-3" ]
0
3
713
2
0
2011-06-01T04:05:08.377000
2011-06-01T05:28:28.883000
6,196,150
6,196,503
unit testing classes that use concrete classes declared in code body
Very simply what I'm trying to find out is, is there any way of cleanly unit testing this body of code? I can instantiate it and run some assertions but I mean actual unit testing where i would mock the service object to remove any dependancies of the class under test and actually have it test only this class and not i...
Given the constraint (that you can't modify/recompile that code ), I'm afraid there is not much you can do apart from "integration testing" it - real dependencies, slow tests. Instantiating a dependency within the method, instead of accepting it as a ctor or method argument makes things difficult. As Ethan says, there ...
unit testing classes that use concrete classes declared in code body Very simply what I'm trying to find out is, is there any way of cleanly unit testing this body of code? I can instantiate it and run some assertions but I mean actual unit testing where i would mock the service object to remove any dependancies of the...
TITLE: unit testing classes that use concrete classes declared in code body QUESTION: Very simply what I'm trying to find out is, is there any way of cleanly unit testing this body of code? I can instantiate it and run some assertions but I mean actual unit testing where i would mock the service object to remove any d...
[ "c#", ".net", "unit-testing", "dependency-injection" ]
1
5
1,734
3
0
2011-06-01T04:06:30.267000
2011-06-01T05:02:10.470000
6,196,152
6,196,183
How to delete a .sdf file created in DataDirectory
I'm creating a SQL CE database file programmatically and want to make sure I'm creating a fresh new one each time so I added the delete method. Since each database file is created in DataDirectory, I would want to delete the file in DataDirectory as well, but it's giving me "illegal characters in path" error following ...
|DataDirectory| is connection string notation and is not related to file system pathes. You can delete the file using the code like this: var directoryName = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location); var fileName = Path.Combine(directoryName, "Foo2Database.sdf"); File.Delete(fileName); You can get cu...
How to delete a .sdf file created in DataDirectory I'm creating a SQL CE database file programmatically and want to make sure I'm creating a fresh new one each time so I added the delete method. Since each database file is created in DataDirectory, I would want to delete the file in DataDirectory as well, but it's givi...
TITLE: How to delete a .sdf file created in DataDirectory QUESTION: I'm creating a SQL CE database file programmatically and want to make sure I'm creating a fresh new one each time so I added the delete method. Since each database file is created in DataDirectory, I would want to delete the file in DataDirectory as w...
[ "c#", "sql-server-ce" ]
3
4
1,288
2
0
2011-06-01T04:06:44.070000
2011-06-01T04:12:53.730000
6,196,202
6,196,372
How to have different build environments for android?
I have dozens of api keys to facebook and twitter and many other services, what is the standard way to have different values for the keys depending on if I am making a development build vs. a staging build vs. a production build?
You can use a static flag to use it in a switch block to define your keys. That works for a simple project with two or three alternative keys. If you really have that many, to use in several projects, I suggest you to add them to a helper class, so you minimise the code changing in your classes. Something like: public ...
How to have different build environments for android? I have dozens of api keys to facebook and twitter and many other services, what is the standard way to have different values for the keys depending on if I am making a development build vs. a staging build vs. a production build?
TITLE: How to have different build environments for android? QUESTION: I have dozens of api keys to facebook and twitter and many other services, what is the standard way to have different values for the keys depending on if I am making a development build vs. a staging build vs. a production build? ANSWER: You can u...
[ "android" ]
11
5
1,184
2
0
2011-06-01T04:15:24.120000
2011-06-01T04:44:24.007000
6,196,212
6,196,326
How do you set a radiobutton as selected using code in gtk?
A radiobuttongroup was created and several radiomenuelems were created in that group. Clicking them results in the expected effect, but how do you set a radiobutton using code? I've searched google for the answer but I can only find other people asking the same question without an answer such as here: http://markmail.o...
You can use Gtk::CheckMenuItem::set_active assuming you are asking about gtkmm, or gtk_check_menu_item_set_active from plain old GTK.
How do you set a radiobutton as selected using code in gtk? A radiobuttongroup was created and several radiomenuelems were created in that group. Clicking them results in the expected effect, but how do you set a radiobutton using code? I've searched google for the answer but I can only find other people asking the sam...
TITLE: How do you set a radiobutton as selected using code in gtk? QUESTION: A radiobuttongroup was created and several radiomenuelems were created in that group. Clicking them results in the expected effect, but how do you set a radiobutton using code? I've searched google for the answer but I can only find other peo...
[ "c++", "gtk", "radio-button" ]
0
1
433
1
0
2011-06-01T04:16:23.887000
2011-06-01T04:35:51.373000
6,196,214
6,196,245
verify URL is live and running or not
I will be taking URL from user. Now I need to verify whether address is live or not. For example: If user enters "google.com", then I will pass "google.com" as argument to some function, and function will return me TRUE if URL is live, upload and running, otherwise FALSE. Any in-built function or some help.
I'd suggest using get_headers($url) and checking to see if one of your responses contains "200 OK". If so, then the site is alive and responded with a valid request. You can also check for other status codes if you want, such as redirects and whatnot.
verify URL is live and running or not I will be taking URL from user. Now I need to verify whether address is live or not. For example: If user enters "google.com", then I will pass "google.com" as argument to some function, and function will return me TRUE if URL is live, upload and running, otherwise FALSE. Any in-bu...
TITLE: verify URL is live and running or not QUESTION: I will be taking URL from user. Now I need to verify whether address is live or not. For example: If user enters "google.com", then I will pass "google.com" as argument to some function, and function will return me TRUE if URL is live, upload and running, otherwis...
[ "php" ]
1
2
2,221
3
0
2011-06-01T04:16:43.697000
2011-06-01T04:23:10.063000
6,196,216
6,196,294
Google Chrome spell check confusion
I just saw something unusual behavior in Google Chrome's inbuilt spell check feature. This feature highlights wrong spellings with a red underline while typing in a textbox. But my doubt is, how can it under-line a the same word when all letters in the word are in small case, eg - facebook and again when i type the sam...
Facebook only refers to one thing-the name of one particular website. That makes it a proper noun, and so it should be capitalized. That's in the same vein that "person" or "website" (generic common nouns) are not capitalized, but "Jim" and "Facebook" (referring to a specific person or website) are. While writing this ...
Google Chrome spell check confusion I just saw something unusual behavior in Google Chrome's inbuilt spell check feature. This feature highlights wrong spellings with a red underline while typing in a textbox. But my doubt is, how can it under-line a the same word when all letters in the word are in small case, eg - fa...
TITLE: Google Chrome spell check confusion QUESTION: I just saw something unusual behavior in Google Chrome's inbuilt spell check feature. This feature highlights wrong spellings with a red underline while typing in a textbox. But my doubt is, how can it under-line a the same word when all letters in the word are in s...
[ "google-chrome" ]
0
3
394
1
0
2011-06-01T04:17:00.957000
2011-06-01T04:30:20.033000
6,196,233
6,201,183
How do you get the sessionFactory in a Grails Geb/Spock test case?
I think I need to flush the hibernate session in a GebSpec test, and so I want to get the sessionFactory. It looks like it should be injected but when I do something like this:- class MySpec extends GebSpec { def sessionFactory... def "test session"(){....do some setup then: assert sessionFactory!= null } it fails with...
The short answer to my question is - why do you want to do that, it's a functional test and it may be remote from the running apps JVM. The why is because I want to check that domain objects have been updated when web stuff happens. Luke Daley kindly pointed out that you can do that using the Remote-Control Grails plug...
How do you get the sessionFactory in a Grails Geb/Spock test case? I think I need to flush the hibernate session in a GebSpec test, and so I want to get the sessionFactory. It looks like it should be injected but when I do something like this:- class MySpec extends GebSpec { def sessionFactory... def "test session"(){....
TITLE: How do you get the sessionFactory in a Grails Geb/Spock test case? QUESTION: I think I need to flush the hibernate session in a GebSpec test, and so I want to get the sessionFactory. It looks like it should be injected but when I do something like this:- class MySpec extends GebSpec { def sessionFactory... def ...
[ "grails", "groovy", "spock", "geb" ]
3
5
5,616
1
0
2011-06-01T04:20:51.723000
2011-06-01T12:32:01.820000
6,196,234
6,196,394
Drag and drop DOM manipulation
I'll start with an example and hopefully it will help explain my question. Say I have two columns. The left column has tabbed content and the right column is empty. I would like to drag a tab from the left column to the right column and have that content displayed in the right column (and that tab would be greyed out i...
I don't think this answers your question directly, but HTML5 has a nifty drag and drop feature which is explained beautifully here Since the model in drag and drop in HTML 5 involves "data transfer" it would probably be best to transfer the ID of the content and load it in the second column even using JQuery for the sa...
Drag and drop DOM manipulation I'll start with an example and hopefully it will help explain my question. Say I have two columns. The left column has tabbed content and the right column is empty. I would like to drag a tab from the left column to the right column and have that content displayed in the right column (and...
TITLE: Drag and drop DOM manipulation QUESTION: I'll start with an example and hopefully it will help explain my question. Say I have two columns. The left column has tabbed content and the right column is empty. I would like to drag a tab from the left column to the right column and have that content displayed in the...
[ "javascript", "jquery", "html", "css", "dom" ]
0
1
1,367
1
0
2011-06-01T04:21:07.853000
2011-06-01T04:47:43.473000
6,196,249
6,196,371
Audio player using UITableView
I would like to create an audio player using UITableView. Every song needs to be a row in this table view controller and I expect every cell to have a play/stop button (only two states). I am managing all the audio meta-data using Core Data and actually storing the song files inside the sandbox (this is a demo applicat...
Subclass UITableViewCell to create two buttons inside of your cells. Assign them actions in the controller for the tableView, and check the indexPath (or a custom identifier assigned to the cell, but that wouldn't be very mvc aware...) of the cells that were toggled to know what sound to play. Be careful with how the c...
Audio player using UITableView I would like to create an audio player using UITableView. Every song needs to be a row in this table view controller and I expect every cell to have a play/stop button (only two states). I am managing all the audio meta-data using Core Data and actually storing the song files inside the s...
TITLE: Audio player using UITableView QUESTION: I would like to create an audio player using UITableView. Every song needs to be a row in this table view controller and I expect every cell to have a play/stop button (only two states). I am managing all the audio meta-data using Core Data and actually storing the song ...
[ "objective-c", "cocoa-touch", "audio", "uitableview" ]
0
2
1,382
1
0
2011-06-01T04:23:47.927000
2011-06-01T04:44:19.593000
6,196,251
6,198,200
undefined working with Javascript -> Actionscript
It must be late, but i'm not seeing the errors of my ways. i'm simply trying to call an AS3 fx from JS. Code: calling the same method within AS3 plays the sound, so I know that the sound plays. The console gives me the following error: Uncaught TypeError: Cannot call method 'playASound' of undefined Thanks!! EDIT RE: P...
You are getting the undefined because it can't find your swf in the DOM. Try using this instead of that "getFlashMovie"-thing document.getElementById('flashObj').playASound(); Don't forget to set the id-attribute of your swf to "flashObj". Also, I recommend using swfobject to embed your swf into your html: swfobject.em...
undefined working with Javascript -> Actionscript It must be late, but i'm not seeing the errors of my ways. i'm simply trying to call an AS3 fx from JS. Code: calling the same method within AS3 plays the sound, so I know that the sound plays. The console gives me the following error: Uncaught TypeError: Cannot call me...
TITLE: undefined working with Javascript -> Actionscript QUESTION: It must be late, but i'm not seeing the errors of my ways. i'm simply trying to call an AS3 fx from JS. Code: calling the same method within AS3 plays the sound, so I know that the sound plays. The console gives me the following error: Uncaught TypeErr...
[ "javascript", "actionscript-3" ]
0
0
1,618
1
0
2011-06-01T04:23:52.407000
2011-06-01T08:19:46.923000
6,196,254
6,196,288
Error in linux fedora-- Permission Denied
I am getting permission denied error in linux fedora while using./newmkapp command. The error message is -- bash:./newmkapp: Permission denied..
check your file permissions with ls -l It should look something like this -rwxr-xr-x 1 jcpennypincher staff 55 5 Jul 2010 newmkapp if you are not the owner you can use chown username:username newmkapp to change ownership, or you can make the file executable by other if you are not the owner or in the group that owns th...
Error in linux fedora-- Permission Denied I am getting permission denied error in linux fedora while using./newmkapp command. The error message is -- bash:./newmkapp: Permission denied..
TITLE: Error in linux fedora-- Permission Denied QUESTION: I am getting permission denied error in linux fedora while using./newmkapp command. The error message is -- bash:./newmkapp: Permission denied.. ANSWER: check your file permissions with ls -l It should look something like this -rwxr-xr-x 1 jcpennypincher staf...
[ "fedora" ]
0
3
9,504
2
0
2011-06-01T04:24:24.170000
2011-06-01T04:29:45.133000
6,196,262
6,196,289
3rd Normal Form on User Account Table, Salts, and Hashes
I understand the importance of salts, hashes and all that good stuff for passwords. My question relates to relational database theory. My understanding of 3rd normal form is that every element must provide a fact about the key, the whole key, and nothing but the key (So help me Codd. Thanks Wikipedia). So I was reviewi...
the "Hash" is dependant on the player_id and the salt. IE: hash -> (username, salt). That's weird. Usually the hash is derived from the salt and the password. In that case, the hash does provide additional and essential information about the specific user, because the password itself is not stored anywhere. If you stor...
3rd Normal Form on User Account Table, Salts, and Hashes I understand the importance of salts, hashes and all that good stuff for passwords. My question relates to relational database theory. My understanding of 3rd normal form is that every element must provide a fact about the key, the whole key, and nothing but the ...
TITLE: 3rd Normal Form on User Account Table, Salts, and Hashes QUESTION: I understand the importance of salts, hashes and all that good stuff for passwords. My question relates to relational database theory. My understanding of 3rd normal form is that every element must provide a fact about the key, the whole key, an...
[ "sql", "database", "normalization", "database-theory" ]
3
1
480
3
0
2011-06-01T04:25:30.610000
2011-06-01T04:29:49.670000
6,196,267
6,196,386
What is the equivalent of DataContext in entity framework?
Linq to SQL has this very simple model: DataContext and attributes [Table] and [Column] and no need for a config file. But I understand Linq2SQL does not have a future. How do I do something equivalent in entity framework? (Equivalent = no config file)
In EF 4.1 Code-First you can configure your mapping in a fluent way as opposed to a config file. It is convention based so it will infer lot of thing from your model (eg: Table column are automatically mapped to properties if both names match). EF Code First Model
What is the equivalent of DataContext in entity framework? Linq to SQL has this very simple model: DataContext and attributes [Table] and [Column] and no need for a config file. But I understand Linq2SQL does not have a future. How do I do something equivalent in entity framework? (Equivalent = no config file)
TITLE: What is the equivalent of DataContext in entity framework? QUESTION: Linq to SQL has this very simple model: DataContext and attributes [Table] and [Column] and no need for a config file. But I understand Linq2SQL does not have a future. How do I do something equivalent in entity framework? (Equivalent = no con...
[ "entity-framework", "linq-to-sql" ]
0
2
603
2
0
2011-06-01T04:26:45.663000
2011-06-01T04:46:24.493000
6,196,274
6,196,674
Create SQLCE database programmatically
[EDITED - with answer] Following is my code to create SQL CE database programmatically: /* get the Path */ var directoryName = System.IO.Path.GetDirectoryName(Assembly.GetEntryAssembly().Location); var fileName = System.IO.Path.Combine(directoryName, "Foo2Database.sdf"); /* check if exists */ if (File.Exists(fileName)...
I have worked with SQLCE 3.1 and SharpDevelop, Try this code and see if this is what you want: string connStr = "Data Source = FooDatabase.sdf; Password = SomePassword"; if (File.Exists("FooDatabase.sdf")) File.Delete("FooDatabase.sdf"); SqlCeEngine engine = new SqlCeEngine(connStr); engine.CreateDatabase(); SqlCeCo...
Create SQLCE database programmatically [EDITED - with answer] Following is my code to create SQL CE database programmatically: /* get the Path */ var directoryName = System.IO.Path.GetDirectoryName(Assembly.GetEntryAssembly().Location); var fileName = System.IO.Path.Combine(directoryName, "Foo2Database.sdf"); /* check...
TITLE: Create SQLCE database programmatically QUESTION: [EDITED - with answer] Following is my code to create SQL CE database programmatically: /* get the Path */ var directoryName = System.IO.Path.GetDirectoryName(Assembly.GetEntryAssembly().Location); var fileName = System.IO.Path.Combine(directoryName, "Foo2Databas...
[ "c#", "sql-server-ce" ]
18
31
23,407
1
0
2011-06-01T04:27:18.803000
2011-06-01T05:26:49.633000
6,196,279
6,196,457
Declaring a Test Dependency in Play!
Is there a way to declare a test dependency in the dependencies.yml file for the Play! Framework? I don't see any information about test dependencies in the documentation. For example, I may want to use a testing library such as Mockito but not have its classes used in production for obvious reasons.
It seems that you can define dependencies per Play framework ID, similar to how you can define settings for a specific ID in the application.conf file. To do this, you need to add an additional id attribute to your dependency definition. For example, if you wanted to only include mockito-core in environments with a fra...
Declaring a Test Dependency in Play! Is there a way to declare a test dependency in the dependencies.yml file for the Play! Framework? I don't see any information about test dependencies in the documentation. For example, I may want to use a testing library such as Mockito but not have its classes used in production fo...
TITLE: Declaring a Test Dependency in Play! QUESTION: Is there a way to declare a test dependency in the dependencies.yml file for the Play! Framework? I don't see any information about test dependencies in the documentation. For example, I may want to use a testing library such as Mockito but not have its classes use...
[ "java", "playframework", "dependency-management" ]
9
9
1,898
1
0
2011-06-01T04:28:09.567000
2011-06-01T04:57:16.313000
6,196,286
6,213,698
Getting typeface and Windows name of font that is not installed
Can someone tell me how can I get the typeface name of a font? And how can I take the Windows name of the font having the typeface name? Like "arialblackno1.ttf" that have typeface "arialblack". but I am looking to get the typeface name of a font that isn't installed, it is just in a folder.
You say in a comment that you need the name of a font that isn't installed in Windows. There are two ways of doing this that I can think of:- Use FreeType Or, use GDI+, and PrivateFontCollection.AddFontFile() Either way, you will need to find Delphi wrappers for these libraries. Google should help. There seems to be a ...
Getting typeface and Windows name of font that is not installed Can someone tell me how can I get the typeface name of a font? And how can I take the Windows name of the font having the typeface name? Like "arialblackno1.ttf" that have typeface "arialblack". but I am looking to get the typeface name of a font that isn'...
TITLE: Getting typeface and Windows name of font that is not installed QUESTION: Can someone tell me how can I get the typeface name of a font? And how can I take the Windows name of the font having the typeface name? Like "arialblackno1.ttf" that have typeface "arialblack". but I am looking to get the typeface name o...
[ "delphi", "fonts", "delphi-7" ]
2
0
1,078
2
0
2011-06-01T04:29:08.427000
2011-06-02T11:03:59.527000
6,196,287
6,204,102
Google Maps direction results not changing after adress change
i mix geolocation and a form input for a route planner. After changing the adress in the form or using geolocation the map works great. But the directions in the directionsDisplay.setPanel are not changing:-( Heres my code: http://pastie.org/2001742 EDIT: i just realised that i get the new directions. But the old direc...
Keep a reference to the previous DirectionsRenderer and call.setMap(null) when you want to disabled it.
Google Maps direction results not changing after adress change i mix geolocation and a form input for a route planner. After changing the adress in the form or using geolocation the map works great. But the directions in the directionsDisplay.setPanel are not changing:-( Heres my code: http://pastie.org/2001742 EDIT: i...
TITLE: Google Maps direction results not changing after adress change QUESTION: i mix geolocation and a form input for a route planner. After changing the adress in the form or using geolocation the map works great. But the directions in the directionsDisplay.setPanel are not changing:-( Heres my code: http://pastie.o...
[ "geolocation", "google-maps-api-3" ]
0
1
284
1
0
2011-06-01T04:29:26.820000
2011-06-01T15:57:33.600000
6,196,292
6,198,323
Mootools Request.JSON Decode
I am a beginner in mootools, can anyone help me figure out how to effectively decode each one of these shouts in JSON to log in the console. var shoutsRequest = new Request.JSON( { url: this.url, onSuccess: function(shouts) { console.log(JSON.decode(shouts)); }, onError: function(text, error) { console.log(text) } } )....
looks like an array containing objects [{}, {}, {}] so you could iterate over the array http://jsfiddle.net/3qnJ2/ http://mootools.net/docs/core/Types/Array#Array:Array-each
Mootools Request.JSON Decode I am a beginner in mootools, can anyone help me figure out how to effectively decode each one of these shouts in JSON to log in the console. var shoutsRequest = new Request.JSON( { url: this.url, onSuccess: function(shouts) { console.log(JSON.decode(shouts)); }, onError: function(text, erro...
TITLE: Mootools Request.JSON Decode QUESTION: I am a beginner in mootools, can anyone help me figure out how to effectively decode each one of these shouts in JSON to log in the console. var shoutsRequest = new Request.JSON( { url: this.url, onSuccess: function(shouts) { console.log(JSON.decode(shouts)); }, onError: f...
[ "json", "mootools", "request" ]
1
1
1,384
1
0
2011-06-01T04:30:09.780000
2011-06-01T08:30:54.957000
6,196,296
6,196,498
How to restart an activity after an exception has occured
I have an App, where I load images from a server. Because of this my app leads to Outofmemory Error. I have caught the exception so that my app is now prevented from being force closed. But my app stops loading images in the place where the exception has occurred. So is there a way I could restart my activity after the...
Restarting the current activity all of a sudden is not going to be a great User experience. If possible try clearing Images from memory that are not not shown to the user(so it releases memory that it has occupied). If still you want to restart the current activity, use the following: void restartActivity() { CurrentAc...
How to restart an activity after an exception has occured I have an App, where I load images from a server. Because of this my app leads to Outofmemory Error. I have caught the exception so that my app is now prevented from being force closed. But my app stops loading images in the place where the exception has occurre...
TITLE: How to restart an activity after an exception has occured QUESTION: I have an App, where I load images from a server. Because of this my app leads to Outofmemory Error. I have caught the exception so that my app is now prevented from being force closed. But my app stops loading images in the place where the exc...
[ "android", "exception", "out-of-memory" ]
1
0
3,191
5
0
2011-06-01T04:30:39
2011-06-01T05:01:38.553000
6,196,297
6,196,853
Render :collection wrap each item?
Currently I'm using: <% @items.each do |item| %> <%= render:partial => '/widgets/vertical_widget',:object => item %> <% end %> to render about 20 items on a page (there's also another 20 of a different widget on the same page). When I look at my server logs it's showing ~400ms per widget render, totaling out to ~20k ms...
Give content_tag a try: #some_file.html.erb <%= render:partial => 'widgets/vertical_widget',:collection => @items,:locals => {:wrap_in =>:li } %> #/widgets/vertical_widget.html.erb #First, render and capture the content once. <% @rendered_content = capture do %> #render the item here <% end %> #Next, decide if the co...
Render :collection wrap each item? Currently I'm using: <% @items.each do |item| %> <%= render:partial => '/widgets/vertical_widget',:object => item %> <% end %> to render about 20 items on a page (there's also another 20 of a different widget on the same page). When I look at my server logs it's showing ~400ms per wid...
TITLE: Render :collection wrap each item? QUESTION: Currently I'm using: <% @items.each do |item| %> <%= render:partial => '/widgets/vertical_widget',:object => item %> <% end %> to render about 20 items on a page (there's also another 20 of a different widget on the same page). When I look at my server logs it's show...
[ "ruby-on-rails" ]
6
4
2,278
2
0
2011-06-01T04:30:43.540000
2011-06-01T05:52:07.857000
6,196,300
6,196,519
ASP.NET Populate ListView with Stored Procedure
I'm trying to populate the ASP.NET LISTVIEW with Stored Procedure(@param1). Could anyone please let me know if it's possible at all. If it's possible, if show me few lines of code will be very helpful.
See the Data Points: Data Source Controls in ASP.NET 2.0 article on MSDN which nicely shows how to use the SqlDataSource in your web app to provide data to data-capable controls. Basically, you need a SqlDataSource > that defines where to connect to to get your data (to your stored proc) - here, you'll need to determin...
ASP.NET Populate ListView with Stored Procedure I'm trying to populate the ASP.NET LISTVIEW with Stored Procedure(@param1). Could anyone please let me know if it's possible at all. If it's possible, if show me few lines of code will be very helpful.
TITLE: ASP.NET Populate ListView with Stored Procedure QUESTION: I'm trying to populate the ASP.NET LISTVIEW with Stored Procedure(@param1). Could anyone please let me know if it's possible at all. If it's possible, if show me few lines of code will be very helpful. ANSWER: See the Data Points: Data Source Controls i...
[ "asp.net", "data-binding" ]
3
3
3,219
1
0
2011-06-01T04:30:53.887000
2011-06-01T05:04:40.170000
6,196,305
6,196,356
How to add simple debug to Application using preprocessor defines
I am developing a GUI app on WinXP but unfortunately std::cerr/cout goes nowhere. I would like to add a simple debug method that appends messages to a log file. I have been hashing together an almost workable solution reading other posts. And am able to have a single debug() method call in my GUI app. However, don't ev...
Your define for logfile is messed up. When your code is preprocessed you'll get: std::ofstream logfile("log/debug.txt", std::ios::app); << "[" << __DATE__ << " " << __TIME__ \ << "] " << __FILE__ << ":" << __LINE__ << " " << "Starting Program" << std::endl; What you would need to do is something like this in a header f...
How to add simple debug to Application using preprocessor defines I am developing a GUI app on WinXP but unfortunately std::cerr/cout goes nowhere. I would like to add a simple debug method that appends messages to a log file. I have been hashing together an almost workable solution reading other posts. And am able to ...
TITLE: How to add simple debug to Application using preprocessor defines QUESTION: I am developing a GUI app on WinXP but unfortunately std::cerr/cout goes nowhere. I would like to add a simple debug method that appends messages to a log file. I have been hashing together an almost workable solution reading other post...
[ "c++", "c" ]
0
0
434
2
0
2011-06-01T04:31:24.400000
2011-06-01T04:40:51.997000
6,196,308
6,196,843
javascript: How to make a module to behave like and object and a function simultaneously?
I'm trying to build myself a little helper library. first, for learning purposes, then that later I can extend it so it may come in handy in projects. I understand somewhat the prototype referencing, closures, and scoping. I also intentionally made it using modular pattern so my toolbox is not polluting the global name...
There's a difference when something is in a prototype and when it's on the object itself. Consider the following example: var foo = function() { return 'I am foo'; } foo.prototype.lie = function() { return 'I am not foo'; } foo.lie(); //error, lie does not exist in foo var bar = new foo; bar.lie(); //it works! protot...
javascript: How to make a module to behave like and object and a function simultaneously? I'm trying to build myself a little helper library. first, for learning purposes, then that later I can extend it so it may come in handy in projects. I understand somewhat the prototype referencing, closures, and scoping. I also ...
TITLE: javascript: How to make a module to behave like and object and a function simultaneously? QUESTION: I'm trying to build myself a little helper library. first, for learning purposes, then that later I can extend it so it may come in handy in projects. I understand somewhat the prototype referencing, closures, an...
[ "closures", "javascript", "prototype-programming", "scoping" ]
0
2
839
3
0
2011-06-01T04:32:03.383000
2011-06-01T05:50:31.947000
6,196,313
6,203,186
presentModalViewController not taking full screen
Landscape only app. On my main window xib, I've got a UIView. I'm loading a UIScrollview programatically into that UIView which works just fine. On that scrollview, I've got a button that brings up a "detail" screen (a separate view controller), via a presentModalViewController call: LearnITViewController *learnit = [[...
Thanks for all the comments. Found a tip somewhere on overriding presentModalViewController and bubbling up in a loop until the main controller's reached (in my case, HomeViewController). Worked like a champ. - (void) presentModalViewController:(UIViewController *)screen animated:(BOOL)animated { UIResponder *responder...
presentModalViewController not taking full screen Landscape only app. On my main window xib, I've got a UIView. I'm loading a UIScrollview programatically into that UIView which works just fine. On that scrollview, I've got a button that brings up a "detail" screen (a separate view controller), via a presentModalViewCo...
TITLE: presentModalViewController not taking full screen QUESTION: Landscape only app. On my main window xib, I've got a UIView. I'm loading a UIScrollview programatically into that UIView which works just fine. On that scrollview, I've got a button that brings up a "detail" screen (a separate view controller), via a ...
[ "iphone", "xcode", "presentmodalviewcontroller" ]
1
1
3,255
4
0
2011-06-01T04:33:29.503000
2011-06-01T14:54:01.190000
6,196,315
6,196,521
How do I define a relationship between two has_many :through models?
I have 2 models "users" and "events" and I used a has_many:through definition to define a many to many relationship between users and events. Each user can belong to 0 or many events and each event can have 0 or many users associated with it. I know when I have a has_many and belongs_to relationship, I can simply do us...
Check out the rails guide on associations. Specifically section 4.3 has_many Association Reference It looks like the method you're looking for is @customer.orders << @order1. In your case, with @user and @event, you'll want to do the following: @user.events << @event and the correct associations will be created.
How do I define a relationship between two has_many :through models? I have 2 models "users" and "events" and I used a has_many:through definition to define a many to many relationship between users and events. Each user can belong to 0 or many events and each event can have 0 or many users associated with it. I know w...
TITLE: How do I define a relationship between two has_many :through models? QUESTION: I have 2 models "users" and "events" and I used a has_many:through definition to define a many to many relationship between users and events. Each user can belong to 0 or many events and each event can have 0 or many users associated...
[ "ruby-on-rails" ]
0
0
181
2
0
2011-06-01T04:33:39.207000
2011-06-01T05:04:53.210000
6,196,321
6,196,328
Echo Control C character
I need to grep the output of a third party program. This program dumps out data but does not terminate without pressing ^c to terminate it. I am currently searching and killing it using its pid. However, I was wondering however if it were possible to echo the control C character. Pseudo code would look like echo ^c |./...
No, piping a CTRL-C character into your process won't work, because a CTRL-C keystroke is captured by the terminal and translated into a kill signal sent to the process. The correct character code (in ASCII) for CTRL-C is code number 3 but, if you echo that to your program, it will simply receive the character from its...
Echo Control C character I need to grep the output of a third party program. This program dumps out data but does not terminate without pressing ^c to terminate it. I am currently searching and killing it using its pid. However, I was wondering however if it were possible to echo the control C character. Pseudo code wo...
TITLE: Echo Control C character QUESTION: I need to grep the output of a third party program. This program dumps out data but does not terminate without pressing ^c to terminate it. I am currently searching and killing it using its pid. However, I was wondering however if it were possible to echo the control C charact...
[ "bash" ]
21
28
55,619
6
0
2011-06-01T04:35:02.230000
2011-06-01T04:36:28.220000
6,196,335
6,197,622
How hibernate session works
I have some kind of trivial queries in Hibernate. If I assume there are two instances running and each is using its own hibernate session. If one session inserts data into DB and the second session tries to retrieve the new data, will it be able to get that data? I have set the primary key to be generated by a DB seque...
yes, once the data is committed to the DB; this does depend on the isolation level configured on the transaction Yes, it will be something like select nextval('MY_SEQUENCE'); this will be the id set to the entity; so, you have an id even if the transaction is not committed yet. This article is worth a read.
How hibernate session works I have some kind of trivial queries in Hibernate. If I assume there are two instances running and each is using its own hibernate session. If one session inserts data into DB and the second session tries to retrieve the new data, will it be able to get that data? I have set the primary key t...
TITLE: How hibernate session works QUESTION: I have some kind of trivial queries in Hibernate. If I assume there are two instances running and each is using its own hibernate session. If one session inserts data into DB and the second session tries to retrieve the new data, will it be able to get that data? I have set...
[ "hibernate" ]
3
2
2,410
1
0
2011-06-01T04:37:15.147000
2011-06-01T07:23:20.137000
6,196,344
6,196,421
Self referencing Foreign Key SQL Server DeleteAction does nto work
I have one Table with a self referencing foreign key with DeleteAction set to Cascade, but when Parent is deleted,no children (direct or descendant) does not delete. What am I missing?
You cannot use cascade delete on self referencing tables. Check this link for possible solution.
Self referencing Foreign Key SQL Server DeleteAction does nto work I have one Table with a self referencing foreign key with DeleteAction set to Cascade, but when Parent is deleted,no children (direct or descendant) does not delete. What am I missing?
TITLE: Self referencing Foreign Key SQL Server DeleteAction does nto work QUESTION: I have one Table with a self referencing foreign key with DeleteAction set to Cascade, but when Parent is deleted,no children (direct or descendant) does not delete. What am I missing? ANSWER: You cannot use cascade delete on self ref...
[ "sql", "sql-server", "t-sql" ]
1
3
1,648
2
0
2011-06-01T04:39:03.123000
2011-06-01T04:51:42.993000
6,196,355
6,196,406
Create a script that runs at 15 minute intervals during working hours of a week
From Monday to Friday, 9 am to 4 pm I want to hit a specific URI. If the hit succeeds, I want to create/overwrite a file (this part is done). I am not sure if doing this using a cron job will be better or creating a background service will be better. I intend to run this on a VPS with 1 GB of RAM. I know it's very litt...
I would vote for the cron job—it's easy enough to add a line to the crontab, or even put a custom file in the /etc/cron.d directory as follows: */15 9-16 * * 1-5 user /your/script/here [EDIT] from comments: In terms of performance and resources, neither is terribly demanding (assuming your script is well written); that...
Create a script that runs at 15 minute intervals during working hours of a week From Monday to Friday, 9 am to 4 pm I want to hit a specific URI. If the hit succeeds, I want to create/overwrite a file (this part is done). I am not sure if doing this using a cron job will be better or creating a background service will ...
TITLE: Create a script that runs at 15 minute intervals during working hours of a week QUESTION: From Monday to Friday, 9 am to 4 pm I want to hit a specific URI. If the hit succeeds, I want to create/overwrite a file (this part is done). I am not sure if doing this using a cron job will be better or creating a backgr...
[ "python", "cron", "background-process" ]
1
5
210
1
0
2011-06-01T04:40:47.613000
2011-06-01T04:50:21.137000
6,196,382
6,196,628
How do I redirect to a page after a file download has been initiated with mod_rewrite?
Just as the title states. Say an individual accesses a file from my database, http://domain.com/database/file.zip. Once that file download has been initiated, I wish the browser to be redirected to the database directory again. Here's what I have so far: RewriteEngine On Options +FollowSymLinks RewriteRule ^Database(.z...
Not really possible with mod_rewrite the way you have described: once the server has started delivering content (sent a 200 status code) there is no way to initiate a second response without a corresponding second request. If you want to do this you'll have to do it on the client side: for example launch the download t...
How do I redirect to a page after a file download has been initiated with mod_rewrite? Just as the title states. Say an individual accesses a file from my database, http://domain.com/database/file.zip. Once that file download has been initiated, I wish the browser to be redirected to the database directory again. Here'...
TITLE: How do I redirect to a page after a file download has been initiated with mod_rewrite? QUESTION: Just as the title states. Say an individual accesses a file from my database, http://domain.com/database/file.zip. Once that file download has been initiated, I wish the browser to be redirected to the database dire...
[ "mod-rewrite", "download" ]
0
0
142
1
0
2011-06-01T04:46:05.737000
2011-06-01T05:19:23.113000
6,196,387
6,196,420
Navigation menu being hidden by jquery picture viewer
As you can kind of see in the image below, my menu is dropping down below my photo viewer. The photo viewer is jquery and CSS. The menu is a implemented as an asp Menu. If anyone has any suggestions please let me know. Thanks div.menu { padding: 0px 0px 0px 0px; width:100%; } div.menu ul { list-style: none; } div.men...
You need to use z-index. Give higher value for div.menu and give lower value for image. See this: http://www.w3schools.com/Css/pr_pos_z-index.asp http://www.w3schools.com/Css/tryit.asp?filename=trycss_zindex
Navigation menu being hidden by jquery picture viewer As you can kind of see in the image below, my menu is dropping down below my photo viewer. The photo viewer is jquery and CSS. The menu is a implemented as an asp Menu. If anyone has any suggestions please let me know. Thanks div.menu { padding: 0px 0px 0px 0px; wid...
TITLE: Navigation menu being hidden by jquery picture viewer QUESTION: As you can kind of see in the image below, my menu is dropping down below my photo viewer. The photo viewer is jquery and CSS. The menu is a implemented as an asp Menu. If anyone has any suggestions please let me know. Thanks div.menu { padding: 0p...
[ "jquery", "asp.net-mvc-3", "menu" ]
0
1
817
2
0
2011-06-01T04:46:49.323000
2011-06-01T04:51:32.763000
6,196,395
6,197,675
how to upload,download, or delete a directory or multiple files in FTP server using CFNetwork?
i have starting learning about FTP Programming, i learn some from simpleFTPSample that using CFNetwork. From this sample i understand how to upload and download a file from ftp server, and also i understand how to get a list file and directory from FTP server. But the problem is, i want to upload, download, and delete ...
i think it will help u http://code.google.com/p/s7ftprequest/ or http://www.ftponthego.com/ you could use cURL if you have little success with the apple sample code, see here. http://www.intelliproject.net/articles/showArticle/index/use_curl_iphone_sdk
how to upload,download, or delete a directory or multiple files in FTP server using CFNetwork? i have starting learning about FTP Programming, i learn some from simpleFTPSample that using CFNetwork. From this sample i understand how to upload and download a file from ftp server, and also i understand how to get a list ...
TITLE: how to upload,download, or delete a directory or multiple files in FTP server using CFNetwork? QUESTION: i have starting learning about FTP Programming, i learn some from simpleFTPSample that using CFNetwork. From this sample i understand how to upload and download a file from ftp server, and also i understand ...
[ "ios4", "upload", "ftp", "directory", "cfnetwork" ]
0
0
787
1
0
2011-06-01T04:47:49.390000
2011-06-01T07:29:00.923000
6,196,402
6,196,431
how to display pop up text on mouse over in php
I have an image on clicking it deletes a user,i want to display the text pop up message delete on mouse over.the code is below. "> how to do this.
Most browsers will display text you enter in a "title" attribute as a tooltip: ie Link text
how to display pop up text on mouse over in php I have an image on clicking it deletes a user,i want to display the text pop up message delete on mouse over.the code is below. "> how to do this.
TITLE: how to display pop up text on mouse over in php QUESTION: I have an image on clicking it deletes a user,i want to display the text pop up message delete on mouse over.the code is below. "> how to do this. ANSWER: Most browsers will display text you enter in a "title" attribute as a tooltip: ie Link text
[ "php", "javascript" ]
1
2
10,264
2
0
2011-06-01T04:48:42.930000
2011-06-01T04:53:47.657000
6,196,409
6,196,428
How to find max value and its associated field values in SQL?
Say I have a list of student names and their marks. I want to find out the highest mark and the student, how can I write one select statement to do that?
Assuming you mean marks rather than remarks, use: select name, mark from students where mark = ( select max(mark) from students ) This will generally result in a fairly efficient query. The subquery should be executed once only (unless your DBMS is brain-dead) and the result fed into the second query. You may want to e...
How to find max value and its associated field values in SQL? Say I have a list of student names and their marks. I want to find out the highest mark and the student, how can I write one select statement to do that?
TITLE: How to find max value and its associated field values in SQL? QUESTION: Say I have a list of student names and their marks. I want to find out the highest mark and the student, how can I write one select statement to do that? ANSWER: Assuming you mean marks rather than remarks, use: select name, mark from stud...
[ "sql" ]
10
11
52,551
7
0
2011-06-01T04:50:43.010000
2011-06-01T04:53:02.307000
6,196,413
6,196,516
How to recursively print the values of an object's properties using reflection
To aid in debugging some code I'm working on, I started to write a method to recursively print out the names and values of an object's properties. However, most of the objects contain nested types and I'd like to print their names and values too, but only on the types I have defined. Here's an outline of what I have so...
The code below has an attempt at that. For "type I have defined" I chose to look at the types in the same assembly as the ones the type whose properties are being printed, but you'll need to update the logic if your types are defined in multiple assemblies. public void PrintProperties(object obj) { PrintProperties(obj,...
How to recursively print the values of an object's properties using reflection To aid in debugging some code I'm working on, I started to write a method to recursively print out the names and values of an object's properties. However, most of the objects contain nested types and I'd like to print their names and values...
TITLE: How to recursively print the values of an object's properties using reflection QUESTION: To aid in debugging some code I'm working on, I started to write a method to recursively print out the names and values of an object's properties. However, most of the objects contain nested types and I'd like to print thei...
[ "c#", "reflection" ]
18
28
22,454
4
0
2011-06-01T04:51:01.927000
2011-06-01T05:04:13.620000
6,196,415
6,196,468
C++ Libraries for abstracting calls against MSSQLS2008 and SQLite?
What are some good options for rendering transparent the small but meaningful differences in parsing and syntax between these two databases? Ideally, I'd like a mature and established library. In generally, in C++, what are some solidly abstracted libraries for high-level data access that don't sacrifice performance? O...
SOCI is a good library for this, it supports SQLite3 and also MSSQL through ODBC. It also has backends for PostgreSQL, MySQL and Oracle if you need to use any of those later on. Using it results in idiomatic stream code, as shown in their documentation: int id =...; string name; int salary; sql << "select name, salary...
C++ Libraries for abstracting calls against MSSQLS2008 and SQLite? What are some good options for rendering transparent the small but meaningful differences in parsing and syntax between these two databases? Ideally, I'd like a mature and established library. In generally, in C++, what are some solidly abstracted libra...
TITLE: C++ Libraries for abstracting calls against MSSQLS2008 and SQLite? QUESTION: What are some good options for rendering transparent the small but meaningful differences in parsing and syntax between these two databases? Ideally, I'd like a mature and established library. In generally, in C++, what are some solidl...
[ "c++", "database", "wrapper" ]
1
1
82
1
0
2011-06-01T04:51:16.553000
2011-06-01T04:57:44.500000
6,196,416
6,196,723
Sorting Lists by Repetitions in Python
I have a list that contains multiple repeated items. I'm trying to sort the list by giving items with the most repetitions priority. So it would turn this ['a', 'b', 'c', 'a', 'b', 'a', 'd'] into this ['a', 'a', 'a', 'b', 'b', 'c', 'd']
>>> from collections import Counter >>> [k for k,v in Counter(['a', 'b', 'c', 'a', 'b', 'a', 'd']).most_common() for i in xrange(v)] ['a', 'a', 'a', 'b', 'b', 'c', 'd'] This is possibly easier to follow >>> counter = Counter(['a', 'b', 'c', 'a', 'b', 'a', 'd']) >>> sorted(counter.elements(), key=counter.get, reverse=Tr...
Sorting Lists by Repetitions in Python I have a list that contains multiple repeated items. I'm trying to sort the list by giving items with the most repetitions priority. So it would turn this ['a', 'b', 'c', 'a', 'b', 'a', 'd'] into this ['a', 'a', 'a', 'b', 'b', 'c', 'd']
TITLE: Sorting Lists by Repetitions in Python QUESTION: I have a list that contains multiple repeated items. I'm trying to sort the list by giving items with the most repetitions priority. So it would turn this ['a', 'b', 'c', 'a', 'b', 'a', 'd'] into this ['a', 'a', 'a', 'b', 'b', 'c', 'd'] ANSWER: >>> from collecti...
[ "python", "list", "sorting" ]
2
5
349
4
0
2011-06-01T04:51:24.283000
2011-06-01T05:34:51.233000
6,196,417
6,207,594
Sharing login and password for personal project with osCommerce store
I'm integrating an application with the osCommerce shopping cart and want users to be able to log into the app with the same account details they do with osCommerce. Everything works fine but I got stuck on the user login system. I need to know how to check against a user entered password in my application against the ...
To check against the password saved in osCommerce, just use the osCommerce function that checks the attempt against the one stored in the database. You'll find this function in the following: catalog/includes/functions/password_funcs.php //// // This funstion validates a plain text password with an encrpyted password f...
Sharing login and password for personal project with osCommerce store I'm integrating an application with the osCommerce shopping cart and want users to be able to log into the app with the same account details they do with osCommerce. Everything works fine but I got stuck on the user login system. I need to know how t...
TITLE: Sharing login and password for personal project with osCommerce store QUESTION: I'm integrating an application with the osCommerce shopping cart and want users to be able to log into the app with the same account details they do with osCommerce. Everything works fine but I got stuck on the user login system. I ...
[ "php", "mysql", "authentication", "oscommerce" ]
0
1
321
1
0
2011-06-01T04:51:25.520000
2011-06-01T20:57:20.180000
6,196,418
6,210,050
Mercurial: How to overwrite files in a particular folder?
I am working on a new project with three other developers, we are all new to Mercurial. A post build event is created in Visual Studio 2010 to copy DLLs to a common folder. Each time anyone commits or updates we want to rewrite without considering version or merging. That is, this particular folder overwrite local work...
The conventional wisdom is that you shouldn't be committing build products at all. You version source code not dlls. Those you download during build from your CI system. That said, if they're all DLLs you can set a custom merger for those: [merge-patterns] **.dll = internal:remote That always uses the "other" version w...
Mercurial: How to overwrite files in a particular folder? I am working on a new project with three other developers, we are all new to Mercurial. A post build event is created in Visual Studio 2010 to copy DLLs to a common folder. Each time anyone commits or updates we want to rewrite without considering version or mer...
TITLE: Mercurial: How to overwrite files in a particular folder? QUESTION: I am working on a new project with three other developers, we are all new to Mercurial. A post build event is created in Visual Studio 2010 to copy DLLs to a common folder. Each time anyone commits or updates we want to rewrite without consider...
[ "mercurial", "tortoisehg", "overwrite" ]
1
2
571
2
0
2011-06-01T04:51:27.153000
2011-06-02T03:27:00.330000
6,196,425
6,196,530
How to set state color of button in android?
I want to custom button, If user pressed it will show red color and still show red until user pressed other button how to do this? thanks.
Try this code: final Button b1 = (Button)findViewById(R.id.btn_1); final Button b2 = (Button)findViewById(R.id.btn_2); b1.setOnClickListener(new View.OnClickListener(){ @Override public void onClick(View v) { // TODO Auto-generated method stub b1.setBackgroundColor(Color.RED); b2.setBackgroundColor(Color.WHITE); } })...
How to set state color of button in android? I want to custom button, If user pressed it will show red color and still show red until user pressed other button how to do this? thanks.
TITLE: How to set state color of button in android? QUESTION: I want to custom button, If user pressed it will show red color and still show red until user pressed other button how to do this? thanks. ANSWER: Try this code: final Button b1 = (Button)findViewById(R.id.btn_1); final Button b2 = (Button)findViewById(R.i...
[ "android", "button" ]
0
1
1,059
6
0
2011-06-01T04:52:09.983000
2011-06-01T05:05:48.827000
6,196,426
6,196,442
what's wrong with using malloc like this?
I got segmentation fault for the following code, could someone help me understand why? typedef struct ClientData { int _clientId; char _msg[200]; } ClientData_t; // in a function char *id = malloc(50); char *msg = malloc(sizeof(MESSAGE_LENGTH)); memset(id, 0, 50); memset(msg, 0, MESSAGE_LENGTH); strcpy(id, &(buffer[1]...
If MESSAGE_LENGTH is an integer, then sizeof( MESSAGE_LENGTH ) is very different from MESSAGE_LENGTH. (It is likely 4 or 8.) You want malloc( MESSAGE_LENGTH ), not malloc( sizeof( MESSAGE_LENGTH )).
what's wrong with using malloc like this? I got segmentation fault for the following code, could someone help me understand why? typedef struct ClientData { int _clientId; char _msg[200]; } ClientData_t; // in a function char *id = malloc(50); char *msg = malloc(sizeof(MESSAGE_LENGTH)); memset(id, 0, 50); memset(msg, ...
TITLE: what's wrong with using malloc like this? QUESTION: I got segmentation fault for the following code, could someone help me understand why? typedef struct ClientData { int _clientId; char _msg[200]; } ClientData_t; // in a function char *id = malloc(50); char *msg = malloc(sizeof(MESSAGE_LENGTH)); memset(id, 0,...
[ "c", "malloc", "segmentation-fault", "assertions" ]
0
6
250
3
0
2011-06-01T04:52:42.650000
2011-06-01T04:55:30.473000
6,196,427
6,196,467
Parse for square brackets with regular expressions
I've always had a difficult time with regular expressions. I've searched for help with this, but I can't quite find what I'm looking for. I have blocks of text that follow this pattern: [php]... any type of code sample here [/php] I need to: check for the square brackets, which can contain any number of 20-30 programmi...
This is the regex you want. It matches where the tags are even too, so a php tag will only end a php tag. /\[(\w+)\](.*?)\[\/\1\]/s Or if you wanted to explicitly match the tags you could use... $langs = array('php', 'python',...); $langs = implode('|', array_map('preg_quote', $langs)); preg_match_all('/\[('. $langs....
Parse for square brackets with regular expressions I've always had a difficult time with regular expressions. I've searched for help with this, but I can't quite find what I'm looking for. I have blocks of text that follow this pattern: [php]... any type of code sample here [/php] I need to: check for the square bracke...
TITLE: Parse for square brackets with regular expressions QUESTION: I've always had a difficult time with regular expressions. I've searched for help with this, but I can't quite find what I'm looking for. I have blocks of text that follow this pattern: [php]... any type of code sample here [/php] I need to: check for...
[ "php", "regex", "debugging" ]
4
5
1,478
4
0
2011-06-01T04:52:58.937000
2011-06-01T04:57:40.317000
6,196,452
6,197,864
C++ static library to be used in XCode
This is probably not a simple question so I am not looking for a definite answer but just some pointers to get me in the right direction. I have absolutely no experience with C/C++ but have good knowledge of Objective-C. I also don't know much about different compilers and architectures so please be nice if I am talkin...
Static libraries contain binary code tailored for some specific operating system and platform. That means that it will use the OS to internally acquire memory (if it uses dynamic memory) or to perform any other OS specific operation (logging, output). Even if the generated code was completely OS-agnostic (basic math co...
C++ static library to be used in XCode This is probably not a simple question so I am not looking for a definite answer but just some pointers to get me in the right direction. I have absolutely no experience with C/C++ but have good knowledge of Objective-C. I also don't know much about different compilers and archite...
TITLE: C++ static library to be used in XCode QUESTION: This is probably not a simple question so I am not looking for a definite answer but just some pointers to get me in the right direction. I have absolutely no experience with C/C++ but have good knowledge of Objective-C. I also don't know much about different com...
[ "iphone", "c++", "objective-c", "static-libraries" ]
2
1
512
1
0
2011-06-01T04:56:56.667000
2011-06-01T07:47:15.607000
6,196,458
6,196,601
jQuery toggle() text in separate element
I am having some trouble getting a toggle function to work and need someone to help explain it to me. My HTML (simplified): Option 1 Option 2 Option 3 Option 4 My jQuery (simplified) $(".item").click(function(){ var tagname = $(this).html(); $('#filter_names').append(' > '+tagname); $(".loading").show(); }); As you ...
You need to look at the #filter_names contents and check if the clicked tag's value is already included, then remove it if it is, or add it otherwise: if (filternames.indexOf(tagname) === -1) { $('#filter_names').append(' > '+tagname); } else { $('#filter_names').text(filternames.replace(' > '+tagname, '')); } Working ...
jQuery toggle() text in separate element I am having some trouble getting a toggle function to work and need someone to help explain it to me. My HTML (simplified): Option 1 Option 2 Option 3 Option 4 My jQuery (simplified) $(".item").click(function(){ var tagname = $(this).html(); $('#filter_names').append(' > '+tagn...
TITLE: jQuery toggle() text in separate element QUESTION: I am having some trouble getting a toggle function to work and need someone to help explain it to me. My HTML (simplified): Option 1 Option 2 Option 3 Option 4 My jQuery (simplified) $(".item").click(function(){ var tagname = $(this).html(); $('#filter_names')...
[ "javascript", "jquery", "toggle" ]
2
2
521
4
0
2011-06-01T04:57:19.717000
2011-06-01T05:15:40.837000
6,196,469
6,210,691
Core plot x-axis labels are not shown
This is my code. X-Axis labels are not shown. I am using core plot. scatterGraph = [[CPXYGraph alloc] initWithFrame:CGRectZero]; CPTheme *theme = nil; [scatterGraph applyTheme:theme]; hostView.hostedGraph = scatterGraph; hostView.backgroundColor = [UIColor clearColor]; hostView.collapsesLayers = NO; scatterGraph.paddi...
I solved the issue. There was a problem with orthogonal coordinates. I solved it like this: scatterPlot.yRange = [CPPlotRange plotRangeWithLocation: CPDecimalFromFloat (min) length:CPDecimalFromFloat(xx)]; xAxis.orthogonalCoordinateDecimal = CPDecimalFromFloat(min); Here plotRangeWithLocation for y-axis and orthogonalC...
Core plot x-axis labels are not shown This is my code. X-Axis labels are not shown. I am using core plot. scatterGraph = [[CPXYGraph alloc] initWithFrame:CGRectZero]; CPTheme *theme = nil; [scatterGraph applyTheme:theme]; hostView.hostedGraph = scatterGraph; hostView.backgroundColor = [UIColor clearColor]; hostView.col...
TITLE: Core plot x-axis labels are not shown QUESTION: This is my code. X-Axis labels are not shown. I am using core plot. scatterGraph = [[CPXYGraph alloc] initWithFrame:CGRectZero]; CPTheme *theme = nil; [scatterGraph applyTheme:theme]; hostView.hostedGraph = scatterGraph; hostView.backgroundColor = [UIColor clearCo...
[ "iphone", "core-plot" ]
1
9
4,025
1
0
2011-06-01T04:57:45.053000
2011-06-02T05:14:07.170000
6,196,471
6,196,543
Is Cassandra Good For Banking Application?
Hello fellow developer,i got very disturbing question about Cassandra,is cassandra good for Banking application which hold sensitive data? because cassandra not using ACID but CAP,how about that? is that any strategy to implement good and secure database in Cassandra?thanks for your response and sorry for my bad englis...
Banking is a wide industry, with many different sorts of systems which might be considered "banking applications". There are some for which Cassandra could be appropriate. However, the lack of ACID support probably rules out financial transaction systems. "how about if i store something sensitive like credit card infor...
Is Cassandra Good For Banking Application? Hello fellow developer,i got very disturbing question about Cassandra,is cassandra good for Banking application which hold sensitive data? because cassandra not using ACID but CAP,how about that? is that any strategy to implement good and secure database in Cassandra?thanks fo...
TITLE: Is Cassandra Good For Banking Application? QUESTION: Hello fellow developer,i got very disturbing question about Cassandra,is cassandra good for Banking application which hold sensitive data? because cassandra not using ACID but CAP,how about that? is that any strategy to implement good and secure database in C...
[ "database-design", "cassandra", "banking", "onlinebanking" ]
4
5
3,790
1
0
2011-06-01T04:58:08.890000
2011-06-01T05:07:49.467000
6,196,483
6,196,493
Omitting Closing Php Tag
Possible Duplicate: Why do some scripts omit the closing php tag '?>'? I've been reading some articles about Omitting Closing PHP tags since they say it is a good programming practice in PHP if your.php file doens't contain any other things. There are many questions like that but after I tried what they've done so far ...
The main issue is you may include additional whitespace (but it can be any chars) after the closing?> (besides one \n which PHP allows, thanks Mario ). This extra whitespace appears to PHP as output to be sent. This makes PHP start sending the response body, therefore making any additional headers being set/modified im...
Omitting Closing Php Tag Possible Duplicate: Why do some scripts omit the closing php tag '?>'? I've been reading some articles about Omitting Closing PHP tags since they say it is a good programming practice in PHP if your.php file doens't contain any other things. There are many questions like that but after I tried ...
TITLE: Omitting Closing Php Tag QUESTION: Possible Duplicate: Why do some scripts omit the closing php tag '?>'? I've been reading some articles about Omitting Closing PHP tags since they say it is a good programming practice in PHP if your.php file doens't contain any other things. There are many questions like that ...
[ "php" ]
6
10
819
4
0
2011-06-01T04:59:26.307000
2011-06-01T05:01:10.613000
6,196,484
6,197,312
how to append a string to a variable that either exists or not?
my solution is like if (not (defined?(@results).nil?)) @results += "run" else @results = "run" end but I believe that there is something simpler...
I would probably do it like this: @results = @results.to_s + "run" This works because NilClass defines a #to_s method that returns a zero-length String, and because instance variables are automatically initialized to nil.
how to append a string to a variable that either exists or not? my solution is like if (not (defined?(@results).nil?)) @results += "run" else @results = "run" end but I believe that there is something simpler...
TITLE: how to append a string to a variable that either exists or not? QUESTION: my solution is like if (not (defined?(@results).nil?)) @results += "run" else @results = "run" end but I believe that there is something simpler... ANSWER: I would probably do it like this: @results = @results.to_s + "run" This works bec...
[ "ruby" ]
16
26
17,627
2
0
2011-06-01T04:59:36.563000
2011-06-01T06:49:52.033000
6,196,485
6,196,531
Custom Landscape/portrait view
I would like to have my buttons arranged a specific way for my portrait view and and different way for my landscape view. I would also like to be able to add things to my landscape view that might now have been in my portrait view. The reasons i know this is possible is obviously, the calculator app that comes with eve...
You can try having two separate nib files for each orientation. You can customize the nib based on that.
Custom Landscape/portrait view I would like to have my buttons arranged a specific way for my portrait view and and different way for my landscape view. I would also like to be able to add things to my landscape view that might now have been in my portrait view. The reasons i know this is possible is obviously, the cal...
TITLE: Custom Landscape/portrait view QUESTION: I would like to have my buttons arranged a specific way for my portrait view and and different way for my landscape view. I would also like to be able to add things to my landscape view that might now have been in my portrait view. The reasons i know this is possible is ...
[ "iphone", "ios", "user-interface", "view", "landscape-portrait" ]
1
5
3,134
2
0
2011-06-01T04:59:37.843000
2011-06-01T05:05:55.410000
6,196,494
6,196,629
Call external programs with CMake
I tried to search the CMake documentation, but I couldn't figure out how to call external programs from CMake. There are few things I want to do. Compile other third-party dependencies that uses a makefile Compile Thrift definition files to C++ / Python stubs. Compile Cython definition files. Another question is, what ...
http://www.kitware.com/media/html/BuildingExternalProjectsWithCMake2.8.html 2+3. can be hacked with CONFIGURE_COMMAND/BUILD_COMMAND/INSTALL_COMMAND
Call external programs with CMake I tried to search the CMake documentation, but I couldn't figure out how to call external programs from CMake. There are few things I want to do. Compile other third-party dependencies that uses a makefile Compile Thrift definition files to C++ / Python stubs. Compile Cython definition...
TITLE: Call external programs with CMake QUESTION: I tried to search the CMake documentation, but I couldn't figure out how to call external programs from CMake. There are few things I want to do. Compile other third-party dependencies that uses a makefile Compile Thrift definition files to C++ / Python stubs. Compile...
[ "cmake", "thrift" ]
5
4
2,844
1
0
2011-06-01T05:01:14.550000
2011-06-01T05:19:40.543000
6,196,499
6,196,663
Interface of Services
I am making an application (actually a Background Service), now i want a little User Interface for that application to set username and password. Can anybody guide me that how can i make an interface for that and what could be the strategy to open that in interface again if i want to change username and password. I don...
What I perceived from your question is that you need to start Activity from Service if that the case below is the code, and dont make this activity as launcher of your application. Intent mIntent = new Intent(getBaseContext(), Activity.class); mIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); getApplication().startActiv...
Interface of Services I am making an application (actually a Background Service), now i want a little User Interface for that application to set username and password. Can anybody guide me that how can i make an interface for that and what could be the strategy to open that in interface again if i want to change userna...
TITLE: Interface of Services QUESTION: I am making an application (actually a Background Service), now i want a little User Interface for that application to set username and password. Can anybody guide me that how can i make an interface for that and what could be the strategy to open that in interface again if i wan...
[ "android", "service", "android-service" ]
2
0
160
4
0
2011-06-01T05:01:38.513000
2011-06-01T05:25:35.283000
6,196,501
6,196,829
How do I get request url in jsf managed bean without the requested servlet?
Assuming the URL is http://localhost:8080/project-name/resource.xhtml, I want to obtain the following http://localhost:8080/project-name in a JSF managed bean.
I'll assume that you are using JSF 2 and Java EE 6 for this answer. The implementation of the actual mechanism will vary depending on the extent to which you'll need the original URL. You'll first need to get access to the underlying servlet container (assumed to one, instead of a portlet container) produced HttpServle...
How do I get request url in jsf managed bean without the requested servlet? Assuming the URL is http://localhost:8080/project-name/resource.xhtml, I want to obtain the following http://localhost:8080/project-name in a JSF managed bean.
TITLE: How do I get request url in jsf managed bean without the requested servlet? QUESTION: Assuming the URL is http://localhost:8080/project-name/resource.xhtml, I want to obtain the following http://localhost:8080/project-name in a JSF managed bean. ANSWER: I'll assume that you are using JSF 2 and Java EE 6 for th...
[ "java", "jsf" ]
48
77
92,983
4
0
2011-06-01T05:01:59.207000
2011-06-01T05:48:18.187000
6,196,502
6,196,545
Explicitly treat link as an absolute link?
I have a control on one of my page which takes some user input (URL) and allows the user to test the link. Click here to test link The problem is if the user puts in the URL "google.com", then the link will be treated as "http://localhost/google.com". I have to put "http://www.google.com" for it to go to the right plac...
Try this... NavigateUrl='<%# Eval("URL", "http://{0}") %>' Edit: if you want to add check whether it already contain http:// then it should be like.. NavigateUrl=<%# Eval("URL").ToString().Contains("http://") == true? Eval("URL"): "http://" + Eval("URL") %>
Explicitly treat link as an absolute link? I have a control on one of my page which takes some user input (URL) and allows the user to test the link. Click here to test link The problem is if the user puts in the URL "google.com", then the link will be treated as "http://localhost/google.com". I have to put "http://www...
TITLE: Explicitly treat link as an absolute link? QUESTION: I have a control on one of my page which takes some user input (URL) and allows the user to test the link. Click here to test link The problem is if the user puts in the URL "google.com", then the link will be treated as "http://localhost/google.com". I have ...
[ "c#", "asp.net", "html", "navigation" ]
7
4
1,365
4
0
2011-06-01T05:02:08.560000
2011-06-01T05:08:08.533000
6,196,513
6,197,988
Should Clojure arrays be as fast as Java arrays
I guess they're the same thing but Clojure uses the Array class to manipulate. Anyway, I've been told that in Clojure if you really need speed then you can use arrays but between the following programs the Java version is much faster (time (let [data (int-array 100000000)] (dotimes [q 100000000] (aset-int data q q)))) ...
Don't use aset-* functions. Just use aset: (aset data q q). Don't ask me why the aset-* functions are there. As long as I can remember their use was discouraged.
Should Clojure arrays be as fast as Java arrays I guess they're the same thing but Clojure uses the Array class to manipulate. Anyway, I've been told that in Clojure if you really need speed then you can use arrays but between the following programs the Java version is much faster (time (let [data (int-array 100000000)...
TITLE: Should Clojure arrays be as fast as Java arrays QUESTION: I guess they're the same thing but Clojure uses the Array class to manipulate. Anyway, I've been told that in Clojure if you really need speed then you can use arrays but between the following programs the Java version is much faster (time (let [data (in...
[ "java", "arrays", "clojure" ]
11
10
505
1
0
2011-06-01T05:03:54.630000
2011-06-01T07:58:17.657000
6,196,526
6,196,558
How to find out whether two string arrays are equal to other
Possible Duplicate: Comparing two List for equality How can I find out whether two arrays of string are equal to each other? I used this, but it does not work, even though the contents of both are the same. string[] array1 = new string[]{"A", "B"} string[] array2 = new string[]{"A", "B"} if(array1 == array2) // it re...
static bool ArraysEqual (T[] a1, T[] a2) { if (ReferenceEquals(a1,a2)) return true; if (a1 == null || a2 == null) return false; if (a1.Length!= a2.Length) return false; EqualityComparer comparer = EqualityComparer.Default; for (int i = 0; i < a1.Length; i++) { if (!comparer.Equals(a1[i], a2[i])) return false; } retu...
How to find out whether two string arrays are equal to other Possible Duplicate: Comparing two List for equality How can I find out whether two arrays of string are equal to each other? I used this, but it does not work, even though the contents of both are the same. string[] array1 = new string[]{"A", "B"} string[] a...
TITLE: How to find out whether two string arrays are equal to other QUESTION: Possible Duplicate: Comparing two List for equality How can I find out whether two arrays of string are equal to each other? I used this, but it does not work, even though the contents of both are the same. string[] array1 = new string[]{"A"...
[ "c#" ]
5
3
15,272
4
0
2011-06-01T05:05:35.710000
2011-06-01T05:09:56.047000
6,196,527
6,197,592
Prevent duplicates in database
$db->query("SELECT * FROM ".DB_PREFIX."users WHERE uid='".$uid_id."' AND login='ExpressCheckoutUser'"); if ($db->moveNext()) { $db->assignStr("address1", $_REQUEST['address_street']); $db->assignStr("city", $_REQUEST['address_city']); $db->assignStr("state", $_REQUEST['address_state']); $db->assignStr("fname", $_REQUE...
First and last name are nice, but everything but unique. I know a few people that have the same name I do, so I guess building a unique index on those two columns will only frustrate, not help. The thing that makes me unique though is that I am the only one who has both my e-mail address and password, so I think that w...
Prevent duplicates in database $db->query("SELECT * FROM ".DB_PREFIX."users WHERE uid='".$uid_id."' AND login='ExpressCheckoutUser'"); if ($db->moveNext()) { $db->assignStr("address1", $_REQUEST['address_street']); $db->assignStr("city", $_REQUEST['address_city']); $db->assignStr("state", $_REQUEST['address_state']); ...
TITLE: Prevent duplicates in database QUESTION: $db->query("SELECT * FROM ".DB_PREFIX."users WHERE uid='".$uid_id."' AND login='ExpressCheckoutUser'"); if ($db->moveNext()) { $db->assignStr("address1", $_REQUEST['address_street']); $db->assignStr("city", $_REQUEST['address_city']); $db->assignStr("state", $_REQUEST['...
[ "php", "sql" ]
1
0
384
4
0
2011-06-01T05:05:36.493000
2011-06-01T07:20:41.140000
6,196,552
6,200,398
sharing address space versus duplicating the page table entries
Before copy on write (COW), when it says that the parent and child process share the same address space, it means that they share the same code segment, data segment, heap and stack right? If the parent and child process share the same address space before COW, what does the page table entries are copied from parent pr...
lets say your process is got var name X that have a virtual address 100 and physical address 200. the PTE is holding a mapping of addresses from virtual 100 to physical 200. after the fork, each process (parent and child) will have his private PTE. at this point both PTEs will map virtual 100 to physical 200. as long a...
sharing address space versus duplicating the page table entries Before copy on write (COW), when it says that the parent and child process share the same address space, it means that they share the same code segment, data segment, heap and stack right? If the parent and child process share the same address space before...
TITLE: sharing address space versus duplicating the page table entries QUESTION: Before copy on write (COW), when it says that the parent and child process share the same address space, it means that they share the same code segment, data segment, heap and stack right? If the parent and child process share the same ad...
[ "process", "linux-kernel", "copy-on-write" ]
4
7
3,663
3
0
2011-06-01T05:08:51.650000
2011-06-01T11:28:39.423000
6,196,553
6,196,567
How to create our own function and how to call in the Ajax in JQUERY?
Hi I want to create my own function using jquery.And I want to call that function in the Ajax.and the calling function should not be like $('div').myfunctionname();
It is not so complicated here is the tutorial from Jquery docs The format to create a plugin/function is this (function( $ ){ $.fn.myPlugin = function() { // Do your awesome plugin stuff here }; })( jQuery );
How to create our own function and how to call in the Ajax in JQUERY? Hi I want to create my own function using jquery.And I want to call that function in the Ajax.and the calling function should not be like $('div').myfunctionname();
TITLE: How to create our own function and how to call in the Ajax in JQUERY? QUESTION: Hi I want to create my own function using jquery.And I want to call that function in the Ajax.and the calling function should not be like $('div').myfunctionname(); ANSWER: It is not so complicated here is the tutorial from Jquery ...
[ "jquery" ]
1
2
78
2
0
2011-06-01T05:09:04.597000
2011-06-01T05:11:05.610000
6,196,556
6,196,585
Can I use WCF for communicating (sending message) between 2 windows service?
Can I use WCF for communicating between 2 windows service? If yes, How?
Sure; you'd usually define a service contract (interface) which the two services will use to exchange messages; then one of the windows services would host a WCF service (in this case, where the two services are in the same machine, you'd usually use a local-only binding, such as named pipes). Then the second win servi...
Can I use WCF for communicating (sending message) between 2 windows service? Can I use WCF for communicating between 2 windows service? If yes, How?
TITLE: Can I use WCF for communicating (sending message) between 2 windows service? QUESTION: Can I use WCF for communicating between 2 windows service? If yes, How? ANSWER: Sure; you'd usually define a service contract (interface) which the two services will use to exchange messages; then one of the windows services...
[ "c#", "wcf", "windows-services", "messaging" ]
1
2
676
3
0
2011-06-01T05:09:23.090000
2011-06-01T05:13:10.060000
6,196,559
6,203,242
WCF over MSMQ, 403 Service unavailable
I setup a WCF service to work over HTTP and MSMQ. It kind of works. The HTTP protocol works 100%. The problem is with net.msmq. When I check the queue, the messages have gone down by 1 which I assume means it's being processed. But at the same time, the service is no longer available. I receive a 403 service unavailabl...
I had the same problem, because I forgot to specify the bindingConfiguration. I had the binding setup like Once I realized the bindingConfiguration was missing from my endpoint, I added it in, and it started working correctly.
WCF over MSMQ, 403 Service unavailable I setup a WCF service to work over HTTP and MSMQ. It kind of works. The HTTP protocol works 100%. The problem is with net.msmq. When I check the queue, the messages have gone down by 1 which I assume means it's being processed. But at the same time, the service is no longer availa...
TITLE: WCF over MSMQ, 403 Service unavailable QUESTION: I setup a WCF service to work over HTTP and MSMQ. It kind of works. The HTTP protocol works 100%. The problem is with net.msmq. When I check the queue, the messages have gone down by 1 which I assume means it's being processed. But at the same time, the service i...
[ "wcf", "msmq" ]
0
0
342
1
0
2011-06-01T05:09:55.877000
2011-06-01T14:57:56.270000
6,196,560
6,202,529
ruby on rails specifying uniqueness in db across multiple columns
I have a model as follows: class EntityTag < ActiveRecord::Base attr_protected:user_id,:post_id,:entity_id belongs_to:user belongs_to:post belongs_to:entity validates:user_id,:presence => true validates:entity_id,:presence => true validates:post_id,:presence => true end I want to guard against multiple rows which hav...
As @dhruvg mentioned: validates_uniqueness_of:user_id,:scope => [:entity_id,:post_id] Do note that uniqueness validation on model level does NOT guarantee uniqueness in the DB. To have that, you should put a unique index on your table. Add the following to your migrations. add_index:entity_tags, [:user_id,:post_id,:ent...
ruby on rails specifying uniqueness in db across multiple columns I have a model as follows: class EntityTag < ActiveRecord::Base attr_protected:user_id,:post_id,:entity_id belongs_to:user belongs_to:post belongs_to:entity validates:user_id,:presence => true validates:entity_id,:presence => true validates:post_id,:pr...
TITLE: ruby on rails specifying uniqueness in db across multiple columns QUESTION: I have a model as follows: class EntityTag < ActiveRecord::Base attr_protected:user_id,:post_id,:entity_id belongs_to:user belongs_to:post belongs_to:entity validates:user_id,:presence => true validates:entity_id,:presence => true val...
[ "ruby-on-rails", "activerecord", "model" ]
1
7
1,924
2
0
2011-06-01T05:10:16.813000
2011-06-01T14:08:12.747000
6,196,568
6,196,675
How to call setTextContent in android
I want to re write xml file using jdom, i got some example in goodle, they used setTextContent to append value in xml tag. but android is not supporting node.setTextContent. instead of this what is the key word for accessing setTextContent. if anyone did this issue pls let me know.
There are no xxxTextContent() methods in org.w3c.dom.Element. A Text Node is just like any other node in xml. You'll need to find the Text node child of your element, and use setNodeValue(). Something like this: node.getFirstChild().setNodeValue(newValue);
How to call setTextContent in android I want to re write xml file using jdom, i got some example in goodle, they used setTextContent to append value in xml tag. but android is not supporting node.setTextContent. instead of this what is the key word for accessing setTextContent. if anyone did this issue pls let me know.
TITLE: How to call setTextContent in android QUESTION: I want to re write xml file using jdom, i got some example in goodle, they used setTextContent to append value in xml tag. but android is not supporting node.setTextContent. instead of this what is the key word for accessing setTextContent. if anyone did this issu...
[ "java", "android", "xml" ]
0
0
432
1
0
2011-06-01T05:11:28.827000
2011-06-01T05:26:54.377000
6,196,573
6,196,812
Display data in (%) for pie chart using the PyChart library in Python
I am creating a pie chart using PyChart library in Python. Here is my code: from pychart import * import sys data = [("foo", 10), ("bar", 20), ("baz", 30), ("ao", 40)] theme.use_color = True theme.get_options() ar = area.T(size = (150, 150), legend = legend.T(), x_grid_style = None, y_grid_style = None) plot = pie_p...
Would converting the data to percentages before passing it to the plot function work? For example: def to_percents(data): total = float(sum(v for _, v in data)) data[:] = [(k, v / total) for k, v in data] return data data = to_percents([("foo", 1), ("bar", 3), ("baz", 5), ("ao", 7)]) print data Output: [('foo', 0.0625...
Display data in (%) for pie chart using the PyChart library in Python I am creating a pie chart using PyChart library in Python. Here is my code: from pychart import * import sys data = [("foo", 10), ("bar", 20), ("baz", 30), ("ao", 40)] theme.use_color = True theme.get_options() ar = area.T(size = (150, 150), legend...
TITLE: Display data in (%) for pie chart using the PyChart library in Python QUESTION: I am creating a pie chart using PyChart library in Python. Here is my code: from pychart import * import sys data = [("foo", 10), ("bar", 20), ("baz", 30), ("ao", 40)] theme.use_color = True theme.get_options() ar = area.T(size = ...
[ "python", "charts", "pie-chart" ]
1
2
1,308
1
0
2011-06-01T05:12:09.073000
2011-06-01T05:46:23.690000
6,196,586
6,196,762
Send command to device with Java
I want to connect magnetic card reader, send commands and get responses with Java (COM Port) in Windows XP. I have.h file & dll. I want use dll functions. How can I connect or send device?
You will need to use JNI (Java Native Interface), google it for details. You probably will have to write some wrappers around the DLL in C first before JNI can use it.
Send command to device with Java I want to connect magnetic card reader, send commands and get responses with Java (COM Port) in Windows XP. I have.h file & dll. I want use dll functions. How can I connect or send device?
TITLE: Send command to device with Java QUESTION: I want to connect magnetic card reader, send commands and get responses with Java (COM Port) in Windows XP. I have.h file & dll. I want use dll functions. How can I connect or send device? ANSWER: You will need to use JNI (Java Native Interface), google it for details...
[ "java", "dll", "java-native-interface", "javax.comm" ]
1
3
557
2
0
2011-06-01T05:13:17.003000
2011-06-01T05:38:55.227000
6,196,594
6,196,667
Socket and JSP application
I am building an application which takes some parameters from jsp and send these parameter to another server using socket. After getting response I have to be in continuous listen mode. How can I update the jsp with response(which comes from another server). a.jsp -->request to b.jsp. In b.jsp it call initialise the ca...
From the jsp, create a HttpURLConnection,and get the inputstream of the HttpURLConnection. Read the data from the inputsream and write it to the jsp writer. You can write a custom tag to do this. Or, check if one already exists.
Socket and JSP application I am building an application which takes some parameters from jsp and send these parameter to another server using socket. After getting response I have to be in continuous listen mode. How can I update the jsp with response(which comes from another server). a.jsp -->request to b.jsp. In b.js...
TITLE: Socket and JSP application QUESTION: I am building an application which takes some parameters from jsp and send these parameter to another server using socket. After getting response I have to be in continuous listen mode. How can I update the jsp with response(which comes from another server). a.jsp -->request...
[ "java", "sockets", "jsp" ]
0
0
1,663
2
0
2011-06-01T05:14:21.463000
2011-06-01T05:26:03.520000
6,196,595
6,196,660
Flash AS3/Mouse position between startDrag and stopDrag
I have a 'drag item' and some 'drop target' so I want to highlight drop target while 'drag item' is dragging so need to track mouse position or listen the mouse move event. I try subscribe ENTER_FRAME event and do hit test but wonder there's any solution for this case. Thank you.
stage.addEventListener(MouseEvent.MOUSE_MOVE, onMouseMove); function onMouseMove(e:MouseEvent):void { //Do your thing here e.updateAfterEvent(); } Note that if you're listening for start/stop drag then you should add/remove the MOUSE_MOVE listener when the start/stop events take place.
Flash AS3/Mouse position between startDrag and stopDrag I have a 'drag item' and some 'drop target' so I want to highlight drop target while 'drag item' is dragging so need to track mouse position or listen the mouse move event. I try subscribe ENTER_FRAME event and do hit test but wonder there's any solution for this ...
TITLE: Flash AS3/Mouse position between startDrag and stopDrag QUESTION: I have a 'drag item' and some 'drop target' so I want to highlight drop target while 'drag item' is dragging so need to track mouse position or listen the mouse move event. I try subscribe ENTER_FRAME event and do hit test but wonder there's any ...
[ "flash", "actionscript-3", "drag-and-drop", "mousemove", "onmousemove" ]
2
1
2,016
1
0
2011-06-01T05:14:25.253000
2011-06-01T05:25:04.407000
6,196,596
6,196,646
Automatic Checking of Incoming Emails
Is their a way to either code server side or client side to check new incoming replies to emails and register them in some way? I read upon using something called Reverse Ajax is this possibly the solution I should look into to code what I want. Also another question is how do you keep track of email conversations? I t...
Split that into two tasks: Checking for e-mails on the server Communication between client and server For 1: messages have a Message-ID header and optionally a References and an In-Reply-To header that allow you to put together conversations. Note that you also have to keep track of sent messages for that to work (beca...
Automatic Checking of Incoming Emails Is their a way to either code server side or client side to check new incoming replies to emails and register them in some way? I read upon using something called Reverse Ajax is this possibly the solution I should look into to code what I want. Also another question is how do you ...
TITLE: Automatic Checking of Incoming Emails QUESTION: Is their a way to either code server side or client side to check new incoming replies to emails and register them in some way? I read upon using something called Reverse Ajax is this possibly the solution I should look into to code what I want. Also another quest...
[ "php", "ajax", "email", "gmail", "reverse-ajax" ]
1
1
200
2
0
2011-06-01T05:14:51.323000
2011-06-01T05:22:21.277000
6,196,598
6,208,784
Flask message flashing fails across redirects
I'm currently working on a project using Flask and Google App Engine. Calling get_flashed_messages() returns empty when I flash a message then use a redirect(): @views.route('/todo/add', methods=["POST"]) def add_todo(): flash('hey') return redirect(url_for('todo_list')) However, if I comment out # SERVER_NAME = 'local...
I got it! The trick is to set server name to something with dots. So 'localhost' became 'app.local' and app.local should be added to /etc/hosts, pointing to the same address as localhost. From the docs: Please keep in mind that not only Flask has the problem of not knowing what subdomains are, your web browser does as ...
Flask message flashing fails across redirects I'm currently working on a project using Flask and Google App Engine. Calling get_flashed_messages() returns empty when I flash a message then use a redirect(): @views.route('/todo/add', methods=["POST"]) def add_todo(): flash('hey') return redirect(url_for('todo_list')) Ho...
TITLE: Flask message flashing fails across redirects QUESTION: I'm currently working on a project using Flask and Google App Engine. Calling get_flashed_messages() returns empty when I flash a message then use a redirect(): @views.route('/todo/add', methods=["POST"]) def add_todo(): flash('hey') return redirect(url_fo...
[ "python", "google-app-engine", "flask" ]
10
10
3,526
2
0
2011-06-01T05:15:28.343000
2011-06-01T23:10:48.970000
6,196,608
6,199,992
TFS SDK - Getting the network credential prompt
I am trying to get the network prompt so that user can provide the credentials. I saw this and It does not help. Could somebody provide a more complete example? The goal is is to get this from a Word Add-in so that I can create work items in TFS from the function points mentioned in the word document. So, somebody writ...
You want to use the UICredentialsProvider when connecting. Here's an example that shows how you would connect to a TFS 2010 Project Collection: // Connect to a project collection by Uri try { var projectCollectionUri = new Uri("http://tfs2010:8080/tfs/MyCollection"); var projectCollection = TfsTeamProjectCollectionFact...
TFS SDK - Getting the network credential prompt I am trying to get the network prompt so that user can provide the credentials. I saw this and It does not help. Could somebody provide a more complete example? The goal is is to get this from a Word Add-in so that I can create work items in TFS from the function points m...
TITLE: TFS SDK - Getting the network credential prompt QUESTION: I am trying to get the network prompt so that user can provide the credentials. I saw this and It does not help. Could somebody provide a more complete example? The goal is is to get this from a Word Add-in so that I can create work items in TFS from the...
[ "tfs", "sdk", "ms-word", "tfs-sdk" ]
0
1
1,151
1
0
2011-06-01T05:16:38.123000
2011-06-01T10:52:29.583000
6,196,622
6,209,167
Using WTForms' populate_obj( ) method with Flask micro framework
I have a template which allows the user to edit their user information. Username: {{user['username']}} New Password: {% if form.password.errors %} {{form.password.errors}} {% endif %} Re-enter Password: I also have a view function for handling such edits by the user. The database I am currently using is MongoDB with th...
UserForm should have request.form passed into it to populate it with the values available in the POST request (if any). form = UserForm(request.form, obj=user)
Using WTForms' populate_obj( ) method with Flask micro framework I have a template which allows the user to edit their user information. Username: {{user['username']}} New Password: {% if form.password.errors %} {{form.password.errors}} {% endif %} Re-enter Password: I also have a view function for handling such edits ...
TITLE: Using WTForms' populate_obj( ) method with Flask micro framework QUESTION: I have a template which allows the user to edit their user information. Username: {{user['username']}} New Password: {% if form.password.errors %} {{form.password.errors}} {% endif %} Re-enter Password: I also have a view function for ha...
[ "python", "flask", "wtforms", "mongokit" ]
9
17
17,625
3
0
2011-06-01T05:18:40.963000
2011-06-02T00:16:57.437000
6,196,625
6,196,704
How to add the "é" in a Font with the resource Editor?
In the resource Editor I created a Font, and I checked the "Create Bitmap" checkbox. The problem is that the "é" is not included in the "Charset". So how to include the "é"? PS: What does "anti-aliasing" mean?
Windows: have you tried pressing alt+0233? Mac: Have you tried pressing option + e then e?
How to add the "é" in a Font with the resource Editor? In the resource Editor I created a Font, and I checked the "Create Bitmap" checkbox. The problem is that the "é" is not included in the "Charset". So how to include the "é"? PS: What does "anti-aliasing" mean?
TITLE: How to add the "é" in a Font with the resource Editor? QUESTION: In the resource Editor I created a Font, and I checked the "Create Bitmap" checkbox. The problem is that the "é" is not included in the "Charset". So how to include the "é"? PS: What does "anti-aliasing" mean? ANSWER: Windows: have you tried pres...
[ "java-me", "lwuit" ]
0
2
109
1
0
2011-06-01T05:18:59.650000
2011-06-01T05:31:54.503000
6,196,636
6,197,896
Displaying bookmarks on an Android device
I am trying to add a bookmark through code to the Android browser. I am able to do that successfully in the emulator, but the same code is not working on the device. Note: when I query, the bookmarks database, the URL is there. It's just not able to display in the device. This is my code snippet ContentValues cv = new ...
I have tested your code snippet and it works, bookmark was added to my Browsers native application (tested on 2.2 HTC Desire). All I had to add to your code was a permission in the AndroidManifest.xml:
Displaying bookmarks on an Android device I am trying to add a bookmark through code to the Android browser. I am able to do that successfully in the emulator, but the same code is not working on the device. Note: when I query, the bookmarks database, the URL is there. It's just not able to display in the device. This ...
TITLE: Displaying bookmarks on an Android device QUESTION: I am trying to add a bookmark through code to the Android browser. I am able to do that successfully in the emulator, but the same code is not working on the device. Note: when I query, the bookmarks database, the URL is there. It's just not able to display in...
[ "android" ]
0
4
955
2
0
2011-06-01T05:21:09.073000
2011-06-01T07:50:41.510000
6,196,641
6,197,680
IE9 JavaScript array initialization bug
Apparently JS implementation in IE9 contains (IMO, critical) bug in handling array literals. In IE9 in some cases this code: var a = [1,2,3,4,]; will create array of length 5 with last element equals to undefined. Here are two versions of my KiTE engine test pages: http://terrainformatica.com/kite/test-kite.htm - works...
A single trailing comma in an array literal should be ignored. Two trailing commas is an elision and should add one to the array's length. So: alert( [1,2,3,4,].length ); // 4 alert( [1,2,3,4,,].length ); // 5 Some versions of IE (< 9?) treat the single trainling comma as an elison and incorrectly add one to length, s...
IE9 JavaScript array initialization bug Apparently JS implementation in IE9 contains (IMO, critical) bug in handling array literals. In IE9 in some cases this code: var a = [1,2,3,4,]; will create array of length 5 with last element equals to undefined. Here are two versions of my KiTE engine test pages: http://terrain...
TITLE: IE9 JavaScript array initialization bug QUESTION: Apparently JS implementation in IE9 contains (IMO, critical) bug in handling array literals. In IE9 in some cases this code: var a = [1,2,3,4,]; will create array of length 5 with last element equals to undefined. Here are two versions of my KiTE engine test pag...
[ "javascript", "internet-explorer-9" ]
10
10
3,914
2
0
2011-06-01T05:21:37.497000
2011-06-01T07:29:35.063000
6,196,647
6,197,618
Want to store in Redis via Node.js
I want to store a hash/JSON data of users in Redis and want to add the user in users hash the user data like this. For example, users = {}; When user rahul logs in then users will become. users = { rahul: { username: 'rahul', } } And when user namita login then users = { rahul: { username: 'rahul', }, namita: { userna...
Probably the most optimal solution to store single hash/json would be to use hashes commands. I also had this " dilemma " and there are several questions regarding data structure containing users with JSON-like objects in Redis. EDIT Use node_redis module. It's actively maintained by a pro a probably the most used node...
Want to store in Redis via Node.js I want to store a hash/JSON data of users in Redis and want to add the user in users hash the user data like this. For example, users = {}; When user rahul logs in then users will become. users = { rahul: { username: 'rahul', } } And when user namita login then users = { rahul: { user...
TITLE: Want to store in Redis via Node.js QUESTION: I want to store a hash/JSON data of users in Redis and want to add the user in users hash the user data like this. For example, users = {}; When user rahul logs in then users will become. users = { rahul: { username: 'rahul', } } And when user namita login then users...
[ "json", "node.js", "redis", "key-value-store" ]
8
22
10,658
1
0
2011-06-01T05:22:35.627000
2011-06-01T07:22:55.430000
6,196,649
6,196,885
Is there any component to create graphical tab pages? (according to the picture)
Is there any component to create graphical Tab Pages like this?
What about those components: IceTabSet SmartTabs Both are with source, and will have the expected aspect. If you search for a component, take a look at the torry.net web site. You probably will find your need here.
Is there any component to create graphical tab pages? (according to the picture) Is there any component to create graphical Tab Pages like this?
TITLE: Is there any component to create graphical tab pages? (according to the picture) QUESTION: Is there any component to create graphical Tab Pages like this? ANSWER: What about those components: IceTabSet SmartTabs Both are with source, and will have the expected aspect. If you search for a component, take a look...
[ "delphi", "tabs" ]
5
8
679
1
0
2011-06-01T05:23:13.503000
2011-06-01T05:57:12.787000
6,196,654
6,212,686
Amazon RDS and Elastic Beanstalk connectivity
There are already several threads where this question is discussed, and I have already tried implementing suggestions discussed in Elastic Beanstalk -> RDS connection error using Grails. I have also opened ports to accept connections from "All" for ICMP, TCP and UDP in my EC2 instance. I have made sure that my RDS and ...
I solved it, pretty foolish answer though. I always felt (thought) that when building a new WAR file for a Grails project in NetBeans it is created in a "production" environment, but that was not the case. I had to go to the project properties and change "Active grails environment" setting to "production" and this fixe...
Amazon RDS and Elastic Beanstalk connectivity There are already several threads where this question is discussed, and I have already tried implementing suggestions discussed in Elastic Beanstalk -> RDS connection error using Grails. I have also opened ports to accept connections from "All" for ICMP, TCP and UDP in my E...
TITLE: Amazon RDS and Elastic Beanstalk connectivity QUESTION: There are already several threads where this question is discussed, and I have already tried implementing suggestions discussed in Elastic Beanstalk -> RDS connection error using Grails. I have also opened ports to accept connections from "All" for ICMP, T...
[ "grails", "amazon-rds", "amazon-elastic-beanstalk" ]
3
1
3,509
1
0
2011-06-01T05:24:11.660000
2011-06-02T09:28:23.677000
6,196,658
6,207,456
ASP.Net to PDF conversion
I am using Itextsharp version 5.0.6 to convert Asp.net page into PDF. I am not able to create the PDF from the HMTML string with the css. If any one knows how to do with css please help me. If any one has experience in iTextsharp kindly advice me and share your experience. Thanks, Parthasarathy M
Having worked with iText's old HTML->PDF code, I can suggest that you: Accept more answers to your questions.:P Don't do that. iText's HTML->PDF converter is acceptable, but its CSS support is still spotty. The new XMLWorker is an improvement, but there's still Much Better Options available to you. I've been a committe...
ASP.Net to PDF conversion I am using Itextsharp version 5.0.6 to convert Asp.net page into PDF. I am not able to create the PDF from the HMTML string with the css. If any one knows how to do with css please help me. If any one has experience in iTextsharp kindly advice me and share your experience. Thanks, Parthasarath...
TITLE: ASP.Net to PDF conversion QUESTION: I am using Itextsharp version 5.0.6 to convert Asp.net page into PDF. I am not able to create the PDF from the HMTML string with the css. If any one knows how to do with css please help me. If any one has experience in iTextsharp kindly advice me and share your experience. Th...
[ "asp.net", "c#-3.0", "itext" ]
0
2
418
1
0
2011-06-01T05:24:53.143000
2011-06-01T20:47:44.110000
6,196,659
6,197,089
How to set text length in button
I want to have a fixed size button If the text is longer than button width, it should show "tex..." How do I do this?
Ellipsize can be used but there is a bug. The workaround is to set scrollHorizontally to true and lines to 1. See the following code example:
How to set text length in button I want to have a fixed size button If the text is longer than button width, it should show "tex..." How do I do this?
TITLE: How to set text length in button QUESTION: I want to have a fixed size button If the text is longer than button width, it should show "tex..." How do I do this? ANSWER: Ellipsize can be used but there is a bug. The workaround is to set scrollHorizontally to true and lines to 1. See the following code example:
[ "android", "button" ]
3
6
4,617
4
0
2011-06-01T05:24:56.377000
2011-06-01T06:24:01.317000
6,196,662
6,196,836
Looking for a good MySQL editor for Ubuntu
As funny as it is, most good MySQL editors are Windows based. I am looking for a tool (US$400 top) for Ubuntu that can: Auto complete tables and fields names + reserved keywords. syntax coloring. inline row content edit. copy tables/databases from one host to an other. I think the best Windows based is SQLyog, but it i...
I highly recommend DbVisualizer. It's a Java application and runs on Linux, Mac OS X and Windows. The MySQL JDBC driver is bundled in the package.
Looking for a good MySQL editor for Ubuntu As funny as it is, most good MySQL editors are Windows based. I am looking for a tool (US$400 top) for Ubuntu that can: Auto complete tables and fields names + reserved keywords. syntax coloring. inline row content edit. copy tables/databases from one host to an other. I think...
TITLE: Looking for a good MySQL editor for Ubuntu QUESTION: As funny as it is, most good MySQL editors are Windows based. I am looking for a tool (US$400 top) for Ubuntu that can: Auto complete tables and fields names + reserved keywords. syntax coloring. inline row content edit. copy tables/databases from one host to...
[ "mysql", "linux", "ubuntu", "editor" ]
3
12
19,234
2
0
2011-06-01T05:25:33.173000
2011-06-01T05:48:57.963000
6,196,666
6,200,421
Converting image to binary array (blob) with HTML5
I am trying to use the 'FileReader' and 'File' APIs that are supported in HTML5 in Chrome and Firefox to convert an image to a binary array, but it does not seem to be working correctly on Chrome. I just have a simple HTML page with a file as the input type: And from here I am using jQuery to grab the contents of the i...
The FileReader API is an asynchronous API, so you need to do something like this instead: var r = new FileReader(); r.onload = function(){ alert(r.result); }; r.readAsBinaryString(file);
Converting image to binary array (blob) with HTML5 I am trying to use the 'FileReader' and 'File' APIs that are supported in HTML5 in Chrome and Firefox to convert an image to a binary array, but it does not seem to be working correctly on Chrome. I just have a simple HTML page with a file as the input type: And from h...
TITLE: Converting image to binary array (blob) with HTML5 QUESTION: I am trying to use the 'FileReader' and 'File' APIs that are supported in HTML5 in Chrome and Firefox to convert an image to a binary array, but it does not seem to be working correctly on Chrome. I just have a simple HTML page with a file as the inpu...
[ "file", "html", "filereader" ]
13
20
46,274
2
0
2011-06-01T05:25:58.960000
2011-06-01T11:30:07.600000
6,196,668
6,196,693
CSS menu with width 100%
I'm trying to make a navigation bar with ul/li but I want it to take all the available width and distribute the size between the li's inside it. Is it possible? thanks!
You can use the table styles. Note that these are not supported in < IE8. HTML home about contact CSS ul { display: table; width: 100%; } ul li { display: table-cell; } jsFiddle. The borders in the jsFiddle there are for visual aid only. They are not necessary.
CSS menu with width 100% I'm trying to make a navigation bar with ul/li but I want it to take all the available width and distribute the size between the li's inside it. Is it possible? thanks!
TITLE: CSS menu with width 100% QUESTION: I'm trying to make a navigation bar with ul/li but I want it to take all the available width and distribute the size between the li's inside it. Is it possible? thanks! ANSWER: You can use the table styles. Note that these are not supported in < IE8. HTML home about contact C...
[ "css" ]
2
6
8,017
1
0
2011-06-01T05:26:04.360000
2011-06-01T05:29:42.923000
6,196,672
6,196,828
ASP.net C# requires IIS restart when new DLL copied to BIN directory
We are receiving a problem whereby every time we copy a dll to the bin directory, our main domain on the website grinds to a halt and the only way to bring it back up is by restarting the "WWW Publishing Service". We run a website which contains a number of IIS applications running off a single server where each of the...
When you put an app_offline.htm file in the wwwroot of your main domain the IIS site goes offline. This is default behavior of IIS as Scott Gu described. When you do this all dlls can be safely overwritten. And when you delete the app_offline.htm file your application will be start up the next time a request comes. Rea...
ASP.net C# requires IIS restart when new DLL copied to BIN directory We are receiving a problem whereby every time we copy a dll to the bin directory, our main domain on the website grinds to a halt and the only way to bring it back up is by restarting the "WWW Publishing Service". We run a website which contains a num...
TITLE: ASP.net C# requires IIS restart when new DLL copied to BIN directory QUESTION: We are receiving a problem whereby every time we copy a dll to the bin directory, our main domain on the website grinds to a halt and the only way to bring it back up is by restarting the "WWW Publishing Service". We run a website wh...
[ "c#", "iis", "iis-7", "windows-server-2008" ]
8
14
20,591
3
0
2011-06-01T05:26:44.117000
2011-06-01T05:48:16.077000
6,196,673
6,196,765
How can I find out if a substring exists in a string using PHP?
I know many questions already asked about this problem, but I was not able to find the right answer for my specific problem. I have a search string - "1|1" I have a array containing following values - "a" => "1|1", "b" => "2|1,1|1", "c" => "3|2,2|1" All I want to do is just to find if the search string existed in the a...
Watch out for the!== operator. We have to check for the type as well.. $searchArray = array('2|2','1|1,3|3','1|1'); $search = '1|1'; foreach ($searchArray as $k=> $value) { if (strpos($value,$search)!== false) { $keysWithMatches[] = $k; } } print_r($keysWithMatches);
How can I find out if a substring exists in a string using PHP? I know many questions already asked about this problem, but I was not able to find the right answer for my specific problem. I have a search string - "1|1" I have a array containing following values - "a" => "1|1", "b" => "2|1,1|1", "c" => "3|2,2|1" All I ...
TITLE: How can I find out if a substring exists in a string using PHP? QUESTION: I know many questions already asked about this problem, but I was not able to find the right answer for my specific problem. I have a search string - "1|1" I have a array containing following values - "a" => "1|1", "b" => "2|1,1|1", "c" =...
[ "php", "string" ]
3
2
3,852
8
0
2011-06-01T05:26:44.787000
2011-06-01T05:39:03.457000
6,196,678
6,197,785
Is it possible to have tuple assignment to variables in Scala?
Possible Duplicate: Tuple parameter declaration and assignment oddity In Scala, one can do multiple-variable assignment to tuples via: val (a, b) = (1, 2) But a similar syntax for assignment to variables doesn't appear to work. For example I'd like to do this: var (c, d) = (3, 4) (c, d) = (5, 6) I'd like to reuse c and...
This isn't simply "multiple variable assignment", it's fully-featured pattern matching! So the following are all valid: val (a, b) = (1, 2) val Array(a, b) = Array(1, 2) val h:: t = List(1, 2) val List(a, Some(b)) = List(1, Option(2)) This is the way that pattern matching works, it'll de-construct something into smalle...
Is it possible to have tuple assignment to variables in Scala? Possible Duplicate: Tuple parameter declaration and assignment oddity In Scala, one can do multiple-variable assignment to tuples via: val (a, b) = (1, 2) But a similar syntax for assignment to variables doesn't appear to work. For example I'd like to do th...
TITLE: Is it possible to have tuple assignment to variables in Scala? QUESTION: Possible Duplicate: Tuple parameter declaration and assignment oddity In Scala, one can do multiple-variable assignment to tuples via: val (a, b) = (1, 2) But a similar syntax for assignment to variables doesn't appear to work. For example...
[ "scala", "variable-assignment", "tuples" ]
54
69
26,884
2
0
2011-06-01T05:27:44.987000
2011-06-01T07:40:14.150000