PostId int64 13 11.8M | PostCreationDate stringlengths 19 19 | OwnerUserId int64 3 1.57M | OwnerCreationDate stringlengths 10 19 | ReputationAtPostCreation int64 -33 210k | OwnerUndeletedAnswerCountAtPostTime int64 0 5.77k | Title stringlengths 10 250 | BodyMarkdown stringlengths 12 30k | Tag1 stringlengths 1 25 ⌀ | Tag2 stringlengths 1 25 ⌀ | Tag3 stringlengths 1 25 ⌀ | Tag4 stringlengths 1 25 ⌀ | Tag5 stringlengths 1 25 ⌀ | PostClosedDate stringlengths 19 19 ⌀ | OpenStatus stringclasses 5 values | unified_texts stringlengths 47 30.1k | OpenStatus_id int64 0 4 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
9,281,577 | 02/14/2012 17:38:04 | 196,919 | 10/26/2009 21:39:42 | 995 | 109 | How to calculate proportional width of an image based on its height? | How to calculate **proportional width** of an image *based on its height*?
I mean we know only an image height only.
Thank you! | c# | .net | null | null | null | 02/14/2012 17:49:42 | not a real question | How to calculate proportional width of an image based on its height?
===
How to calculate **proportional width** of an image *based on its height*?
I mean we know only an image height only.
Thank you! | 1 |
7,828,129 | 10/19/2011 21:06:21 | 38,743 | 11/18/2008 23:19:02 | 3,988 | 135 | Drupal 7 - case-insensitive LIKE with db_select | I can't get a query to be case-insensitive using MySQL and Drupal 7. Here's my module code:
$results = db_select('people_table', 'p')->fields('p');
if (array_key_exists('department', $_GET)) {
$results->condition('Department', '%' . db_like($_GET['department']) . '%', 'LIKE');
}
return $results->orderBy('Name', 'ASC')->execute();
With `?department=Chemistry` in the URL, I get three results. With `?department=chemistry` in the URL, I get no results. When I try `$results->condition('UPPER(Department)'...`, I get this error:
> PDOException: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'UPPERDepartment' in 'where clause': SELECT p.* FROM {people_table} p WHERE (UPPERDepartment LIKE :db_condition_placeholder_0 ESCAPE '\\\\') ORDER BY Name ASC;
So it looks like it eats my parentheses. How can I do a case-insensitive `LIKE`? | php | mysql | drupal | select | case-insensitive | null | open | Drupal 7 - case-insensitive LIKE with db_select
===
I can't get a query to be case-insensitive using MySQL and Drupal 7. Here's my module code:
$results = db_select('people_table', 'p')->fields('p');
if (array_key_exists('department', $_GET)) {
$results->condition('Department', '%' . db_like($_GET['department']) . '%', 'LIKE');
}
return $results->orderBy('Name', 'ASC')->execute();
With `?department=Chemistry` in the URL, I get three results. With `?department=chemistry` in the URL, I get no results. When I try `$results->condition('UPPER(Department)'...`, I get this error:
> PDOException: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'UPPERDepartment' in 'where clause': SELECT p.* FROM {people_table} p WHERE (UPPERDepartment LIKE :db_condition_placeholder_0 ESCAPE '\\\\') ORDER BY Name ASC;
So it looks like it eats my parentheses. How can I do a case-insensitive `LIKE`? | 0 |
7,421,577 | 09/14/2011 19:01:31 | 379,417 | 06/29/2010 20:21:16 | 23 | 3 | Failing to call WCF Service | I have a WCF Service being hosted on IIS 5.1 with Anonymous access disabled. Below is a part of the web.config file showing how the service is configured:
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="basicHttpBindingCfg">
<security mode="TransportCredentialOnly">
<transport clientCredentialType="Windows" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<services>
<service behaviorConfiguration="ServiceBehavior" name="HelloService">
<endpoint address="" binding="basicHttpBinding" bindingConfiguration="basicHttpBindingCfg"
name="BasicHttpEndpoint" contract="IHelloService">
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="ServiceBehavior">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
Every time I call any operations that this service exposes from a desktop application, I receive the following error message:
**Either a required impersonation level was not provided, or the provided impersonation level is invalid.**
Please note that binding type and hosting environment is pre-determined by the client and cannot be changed.
Any help that may lead to resolving this issue would be greatly appreciated.
Thanks!
Zen | wcf | basichttpbinding | null | null | null | null | open | Failing to call WCF Service
===
I have a WCF Service being hosted on IIS 5.1 with Anonymous access disabled. Below is a part of the web.config file showing how the service is configured:
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="basicHttpBindingCfg">
<security mode="TransportCredentialOnly">
<transport clientCredentialType="Windows" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<services>
<service behaviorConfiguration="ServiceBehavior" name="HelloService">
<endpoint address="" binding="basicHttpBinding" bindingConfiguration="basicHttpBindingCfg"
name="BasicHttpEndpoint" contract="IHelloService">
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="ServiceBehavior">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
Every time I call any operations that this service exposes from a desktop application, I receive the following error message:
**Either a required impersonation level was not provided, or the provided impersonation level is invalid.**
Please note that binding type and hosting environment is pre-determined by the client and cannot be changed.
Any help that may lead to resolving this issue would be greatly appreciated.
Thanks!
Zen | 0 |
6,236,361 | 06/04/2011 11:05:39 | 655,336 | 03/11/2011 12:37:47 | 5 | 0 | asp.net mvc 3 ssl | I m using asp.net mvc3.0 and have created the application. The problem is when I execute the program with ssl it gives me error "A script on this page is causing Internet Explorer to run slowly. If it continues to run, your computer may become unresponsive."
But if I run without ssl it works fine, the problem is with IE 8.
In Firefox its working fine.
Please help me to know how can I overcome this problem. | javascript | asp.net-mvc-3 | null | null | null | 06/04/2011 13:52:48 | not a real question | asp.net mvc 3 ssl
===
I m using asp.net mvc3.0 and have created the application. The problem is when I execute the program with ssl it gives me error "A script on this page is causing Internet Explorer to run slowly. If it continues to run, your computer may become unresponsive."
But if I run without ssl it works fine, the problem is with IE 8.
In Firefox its working fine.
Please help me to know how can I overcome this problem. | 1 |
7,293,058 | 09/03/2011 12:17:25 | 658,740 | 03/14/2011 12:03:44 | 401 | 22 | Place Order fails in Magento OnePage Checkout | I have a Magento store that has been converted to a "one deal at a time" type store, and the checkout process is broken. I've been trying to debug this, but have hit a wall, primarily due to my limited understanding of Magento.
On the saveOrder step, when clicking "Place Order", the page shows "submitting order information, then the message clears and the shopper is still on the Order Review page.
I've analyzed with Firebug and HttpFox, and I can see the order information is being sent
(Request-Line) POST /checkout/onepage/saveOrder/ HTTP/1.1
Host www.domainname.com
User-Agent Mozilla/5.0 (Windows NT 6.0; rv:2.0) Gecko/20100101 Firefox/4.0
Accept text/javascript, text/html, application/xml, text/xml, */*
Accept-Language en-us,en;q=0.5
Accept-Encoding gzip, deflate
Accept-Charset ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive 115
Connection keep-alive
X-Requested-With XMLHttpRequest
X-Prototype-Version 1.6.0.3
Content-Type application/x-www-form-urlencoded; charset=UTF-8
Referer https://www.domainname.com/checkout/onepage/
Content-Length 178
Cookie frontend=cd60252d28cd115d4096cb2bb5b6a043
Pragma no-cache
Cache-Control no-cache
Post Data shows all of the required information:
payment[method] authorizenet
payment[cc_type] VI
payment[cc_number] 4460534300944082
payment[cc_number] 4111111111111111
payment[cc_exp_month] 5
payment[cc_exp_year] 2012
payment[cc_cid] 987
My problem seemed similar to this post:
http://fishpig.co.uk/magento-tutorials/magento-checkout-error-undefined-javascript-alert
but I'm not getting an "Undefined" alert, so I added the "else" statement below:
nextStep: function(transport){
if (transport && transport.responseText) {
alert(transport.responseText);
try{
response = eval('(' + transport.responseText + ')');
}
catch (e) {
response = {};
}
if (response.redirect) {
location.href = response.redirect;
return;
}
if (response.success) {
this.isSuccess = true;
window.location=this.successUrl;
}
else{
var msg = response.error_messages;
if (typeof(msg)=='object') {
msg = msg.join("\n");
}
alert(msg);
}
if (response.update_section) {
$('checkout-'+response.update_section.name+'-load').update(response.update_section.html);
response.update_section.html.evalScripts();
}
if (response.goto_section) {
checkout.gotoSection(response.goto_section);
checkout.reloadProgressBlock();
}
} else {
alert('transport.responseText');
}
},
I am getting the JS alert with no text, so it looks like transport.reponseText is empty. The main references to empty response text I've found appear to be related to same-origin policy, which I don't think applies, because my AJAX post is to and from www.domainname.com.
When I call the saveOrder function directly in the browser, I'm receiving a valid response:
https://www.domainname.com/checkout/onepage/saveOrder
{"success":false,"error":true,"error_messages":"Credit card number mismatch with credit card type"}
and HTTPFox shows I'm getting a 200 response from the Ajax call, but the responsetext is simply empty. I find no PHP errors or errors in Magento's exceptions log. The only thing I'm finding that might be related is "Headers already sent' in Magento's system log:
</pre>
2011-09-03T12:14:21+00:00 DEBUG (7): HEADERS ALREADY SENT: <pre>[0] /home/sbrshop/wwwroot/app/code/core/Mage/Core/Controller/Response/Http.php:50
[1] /home/sbrshop/wwwroot/lib/Zend/Controller/Response/Abstract.php:726
[2] /home/sbrshop/wwwroot/app/code/core/Mage/Core/Controller/Response/Http.php:82
[3] /home/sbrshop/wwwroot/app/code/core/Mage/Core/Controller/Varien/Front.php:169
[4] /home/sbrshop/wwwroot/app/Mage.php:459
[5] /home/sbrshop/wwwroot/index.php:67
</pre>
Does anyone have any suggestions why else the responseText is coming back empty?
| php | ajax | magento | null | null | null | open | Place Order fails in Magento OnePage Checkout
===
I have a Magento store that has been converted to a "one deal at a time" type store, and the checkout process is broken. I've been trying to debug this, but have hit a wall, primarily due to my limited understanding of Magento.
On the saveOrder step, when clicking "Place Order", the page shows "submitting order information, then the message clears and the shopper is still on the Order Review page.
I've analyzed with Firebug and HttpFox, and I can see the order information is being sent
(Request-Line) POST /checkout/onepage/saveOrder/ HTTP/1.1
Host www.domainname.com
User-Agent Mozilla/5.0 (Windows NT 6.0; rv:2.0) Gecko/20100101 Firefox/4.0
Accept text/javascript, text/html, application/xml, text/xml, */*
Accept-Language en-us,en;q=0.5
Accept-Encoding gzip, deflate
Accept-Charset ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive 115
Connection keep-alive
X-Requested-With XMLHttpRequest
X-Prototype-Version 1.6.0.3
Content-Type application/x-www-form-urlencoded; charset=UTF-8
Referer https://www.domainname.com/checkout/onepage/
Content-Length 178
Cookie frontend=cd60252d28cd115d4096cb2bb5b6a043
Pragma no-cache
Cache-Control no-cache
Post Data shows all of the required information:
payment[method] authorizenet
payment[cc_type] VI
payment[cc_number] 4460534300944082
payment[cc_number] 4111111111111111
payment[cc_exp_month] 5
payment[cc_exp_year] 2012
payment[cc_cid] 987
My problem seemed similar to this post:
http://fishpig.co.uk/magento-tutorials/magento-checkout-error-undefined-javascript-alert
but I'm not getting an "Undefined" alert, so I added the "else" statement below:
nextStep: function(transport){
if (transport && transport.responseText) {
alert(transport.responseText);
try{
response = eval('(' + transport.responseText + ')');
}
catch (e) {
response = {};
}
if (response.redirect) {
location.href = response.redirect;
return;
}
if (response.success) {
this.isSuccess = true;
window.location=this.successUrl;
}
else{
var msg = response.error_messages;
if (typeof(msg)=='object') {
msg = msg.join("\n");
}
alert(msg);
}
if (response.update_section) {
$('checkout-'+response.update_section.name+'-load').update(response.update_section.html);
response.update_section.html.evalScripts();
}
if (response.goto_section) {
checkout.gotoSection(response.goto_section);
checkout.reloadProgressBlock();
}
} else {
alert('transport.responseText');
}
},
I am getting the JS alert with no text, so it looks like transport.reponseText is empty. The main references to empty response text I've found appear to be related to same-origin policy, which I don't think applies, because my AJAX post is to and from www.domainname.com.
When I call the saveOrder function directly in the browser, I'm receiving a valid response:
https://www.domainname.com/checkout/onepage/saveOrder
{"success":false,"error":true,"error_messages":"Credit card number mismatch with credit card type"}
and HTTPFox shows I'm getting a 200 response from the Ajax call, but the responsetext is simply empty. I find no PHP errors or errors in Magento's exceptions log. The only thing I'm finding that might be related is "Headers already sent' in Magento's system log:
</pre>
2011-09-03T12:14:21+00:00 DEBUG (7): HEADERS ALREADY SENT: <pre>[0] /home/sbrshop/wwwroot/app/code/core/Mage/Core/Controller/Response/Http.php:50
[1] /home/sbrshop/wwwroot/lib/Zend/Controller/Response/Abstract.php:726
[2] /home/sbrshop/wwwroot/app/code/core/Mage/Core/Controller/Response/Http.php:82
[3] /home/sbrshop/wwwroot/app/code/core/Mage/Core/Controller/Varien/Front.php:169
[4] /home/sbrshop/wwwroot/app/Mage.php:459
[5] /home/sbrshop/wwwroot/index.php:67
</pre>
Does anyone have any suggestions why else the responseText is coming back empty?
| 0 |
7,752,948 | 10/13/2011 10:46:32 | 990,194 | 10/11/2011 19:22:56 | 1 | 0 | Ruby on Rails Book | Do you suggest any books for learning ruby on rails? I already know some OO programming. I know there are many other topics like this one, but I am afraid that they might be a little bit outdated.
What do you suggest?
thx | ruby-on-rails | books | null | null | null | 10/14/2011 07:55:07 | not constructive | Ruby on Rails Book
===
Do you suggest any books for learning ruby on rails? I already know some OO programming. I know there are many other topics like this one, but I am afraid that they might be a little bit outdated.
What do you suggest?
thx | 4 |
3,789,560 | 09/24/2010 17:34:14 | 307,861 | 04/02/2010 18:14:10 | 17 | 0 | Calling 64-bit COM control from 32-bit app | We have a situation where one of our products is a 32-bit app, but needs to communicate with instruments via 64-bit COM control (which wraps a 64-bit device driver). For various reasons, we don't want to compile this app as a 64-bit app, but we DO want to run it on a 64-bit OS. Since the drivers and COM control must be 64-bit to work, what are our options for accessing them from the 32-bit side?
Can anyone point me in the right direction on this?
Thanks
Curtis
| c++ | com | 64bit | null | null | null | open | Calling 64-bit COM control from 32-bit app
===
We have a situation where one of our products is a 32-bit app, but needs to communicate with instruments via 64-bit COM control (which wraps a 64-bit device driver). For various reasons, we don't want to compile this app as a 64-bit app, but we DO want to run it on a 64-bit OS. Since the drivers and COM control must be 64-bit to work, what are our options for accessing them from the 32-bit side?
Can anyone point me in the right direction on this?
Thanks
Curtis
| 0 |
9,590,560 | 03/06/2012 19:33:44 | 1,253,073 | 03/06/2012 19:23:30 | 1 | 0 | DB connections are closing causing slow performance: MS SQL SERVER | I have two applications that uses the same 2 databases. 1 application runs fine, no performance issues. When i run the query below i get 1 connection per database. They stay open for a while. So as I browse it seems that those two connections are reused. After a while they close.
When I run the second application the connection is opened and immediately closed. I notice that when I run the query below the values of the number of connections increases while the page is refreshing and as soon as the page is done loading the number of connections is reduced.
I added this to the connection string:
Max Pool Size=75;Min Pool Size=5;
but the number of connections now jumped from 0 to 5 and then jumps back down to 0
This is causing the app to be very slow as some pages have many queries in them.
Any help on resolving this issue would be appreciated.
The query:
SELECT
DB_NAME(dbid) as DBName,
COUNT(dbid) as NumberOfConnections,
loginame as LoginName
FROM
sys.sysprocesses
WHERE
dbid > 0
GROUP BY
dbid, loginame | sql | sql-server-2008 | connection-pooling | null | null | null | open | DB connections are closing causing slow performance: MS SQL SERVER
===
I have two applications that uses the same 2 databases. 1 application runs fine, no performance issues. When i run the query below i get 1 connection per database. They stay open for a while. So as I browse it seems that those two connections are reused. After a while they close.
When I run the second application the connection is opened and immediately closed. I notice that when I run the query below the values of the number of connections increases while the page is refreshing and as soon as the page is done loading the number of connections is reduced.
I added this to the connection string:
Max Pool Size=75;Min Pool Size=5;
but the number of connections now jumped from 0 to 5 and then jumps back down to 0
This is causing the app to be very slow as some pages have many queries in them.
Any help on resolving this issue would be appreciated.
The query:
SELECT
DB_NAME(dbid) as DBName,
COUNT(dbid) as NumberOfConnections,
loginame as LoginName
FROM
sys.sysprocesses
WHERE
dbid > 0
GROUP BY
dbid, loginame | 0 |
942,734 | 06/03/2009 01:49:27 | 82,337 | 03/25/2009 01:44:49 | 26 | 0 | [ASP.NET] How to prevent adding same event in Asp.net page | I have been write code in Page_Load function like this
protected void Page_Load(object sender, EventArgs e)
{
if(!IsPostBack)
{
UserControl1.Button_Clicked += new EventHandler(UserControl1_Button_Clicked);
}
}
But the same function will be added again when the page is directing to this page from the other page.
Is there any kind of method to prevent it happened?
I'm trying to use session to prevent it, but I would like to know is there any better method can do the same work.
Thanks a lot!
| c# | asp.net | null | null | null | null | open | [ASP.NET] How to prevent adding same event in Asp.net page
===
I have been write code in Page_Load function like this
protected void Page_Load(object sender, EventArgs e)
{
if(!IsPostBack)
{
UserControl1.Button_Clicked += new EventHandler(UserControl1_Button_Clicked);
}
}
But the same function will be added again when the page is directing to this page from the other page.
Is there any kind of method to prevent it happened?
I'm trying to use session to prevent it, but I would like to know is there any better method can do the same work.
Thanks a lot!
| 0 |
2,319,665 | 02/23/2010 16:08:13 | 277,414 | 02/19/2010 23:22:21 | 13 | 0 | java move image with mouse | i want to put this image on a map, so i want:
- click a button and make a new image
- move the image with the mouse and when click the image must be on the jpanel and not move anymore. | java | move | image | with | mouse | null | open | java move image with mouse
===
i want to put this image on a map, so i want:
- click a button and make a new image
- move the image with the mouse and when click the image must be on the jpanel and not move anymore. | 0 |
8,240,613 | 11/23/2011 10:26:30 | 1,059,247 | 11/22/2011 06:52:14 | 1 | 0 | how to do camera for taking snap and stored into SD card? | im implementing one application that contains a button side by small screen for taking pic from camera....i need initially how camera starts and if button press snap an stored into SD card ..how to stored into SD card ..any one plz help me | java | android | android-layout | null | null | 11/24/2011 02:41:47 | not a real question | how to do camera for taking snap and stored into SD card?
===
im implementing one application that contains a button side by small screen for taking pic from camera....i need initially how camera starts and if button press snap an stored into SD card ..how to stored into SD card ..any one plz help me | 1 |
11,151,620 | 06/22/2012 07:08:08 | 1,395,692 | 05/15/2012 08:49:00 | 64 | 1 | CSS : centering a fixed menu with no specific width | i've been struggling with something: centering my CSS menu!! i can't figure out how to do it. What am i doing wrong?
http://jsfiddle.net/yfVs2/ | html | css | menu | null | null | null | open | CSS : centering a fixed menu with no specific width
===
i've been struggling with something: centering my CSS menu!! i can't figure out how to do it. What am i doing wrong?
http://jsfiddle.net/yfVs2/ | 0 |
5,897,936 | 05/05/2011 12:49:31 | 480,346 | 10/19/2010 10:23:33 | 330 | 5 | What is the max length of iPhone App Name? | What is the maximum length of iPhone App name we can have?
Thanks! | iphone | objective-c | cocoa-touch | iphone-sdk-4.0 | iphone-sdk-3.0 | 05/10/2011 01:06:53 | not a real question | What is the max length of iPhone App Name?
===
What is the maximum length of iPhone App name we can have?
Thanks! | 1 |
9,663,734 | 03/12/2012 08:24:24 | 196,210 | 10/25/2009 15:26:47 | 197 | 5 | Oracle: creating a query that gives a score to a record (using IF ELSE in a query) | Should I use something like SUM(IF... sintax)? | sql | oracle | null | null | null | 03/12/2012 18:18:27 | not a real question | Oracle: creating a query that gives a score to a record (using IF ELSE in a query)
===
Should I use something like SUM(IF... sintax)? | 1 |
7,145,562 | 08/22/2011 09:41:42 | 831,970 | 07/06/2011 16:12:23 | 18 | 6 | Colorize text/background, how to make pretty-print portable? Also, large list of Color Functions written by Aesthir, enjoy? | Although this isn't a specific question, I do have one.... but first, I'd like to share `[ Aesthir's Color Functions™ ]`... —— it's not really trademarked ;^) —— with all the shell-coders out there who would like things to look a bit nicer. I use these religiously throughout all my scripts (70+ now), just for fun, to easily separate data and to organize better.
Below are the color functions that I use regularly... wrote them years ago and have gotten so used to them that they're a regular part of my scripting. They function as `printf` substitutes, so rather than boring old `printf "Hello\n"`, a green hello simply `Tgreen "Hello\n"` Just stick this code block into your .bashrc file, start a new session, and you're set! Hell stick some into your PSn variables for easy color prompts. For instance, here is my select prompt: `export PS3="$(Tmagenta ' 〔Select〕 ')"`, and my sudo prompt: `export SUDO_PROMPT=" $(Tgreen '〔Password〕') "`. These are the ones I use:
<HR>
## ∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞ ##
## ∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞ [ Aesthir's Color Functions ] ∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞ ##
## ∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞ ##
Normal () { printf '\e[m'"$*"; } ; Tblack () { printf '\e[0;30m'"$*"'\e[m'; }
TNormal () { printf '\e[m'"$*"; } ; Tred () { printf '\e[0;31m'"$*"'\e[m'; }
Bold () { printf '\e[1m'"$*"'\e[m'; } ; Tgreen () { printf '\e[0;32m'"$*"'\e[m'; }
TBold () { printf '\e[1m'"$*"'\e[m'; } ; Tbrown () { printf '\e[0;33m'"$*"'\e[m'; }
Underline () { printf '\e[4m'"$*"'\e[m'; } ; Tyellow () { printf '\e[0;33m'"$*"'\e[m'; }
TUnderline () { printf '\e[4m'"$*"'\e[m'; } ; Tblue () { printf '\e[0;34m'"$*"'\e[m'; }
Flash () { printf '\e[5m'"$*"'\e[m'; } ; Tmagenta () { printf '\e[0;35m'"$*"'\e[m'; }
TFlash () { printf '\e[5m'"$*"'\e[m'; } ; Tpurple () { printf '\e[0;35m'"$*"'\e[m'; }
Invert () { printf '\e[7m'"$*"'\e[m'; } ; Taqua () { printf '\e[0;36m'"$*"'\e[m'; }
TInvert () { printf '\e[7m'"$*"'\e[m'; } ; Tcyan () { printf '\e[0;36m'"$*"'\e[m'; }
Invisible () { printf '\e[8m'"$*"'\e[m'; } ; Tgrey () { printf '\e[0;37m'"$*"'\e[m'; }
TInvisible () { printf '\e[8m'"$*"'\e[m'; } ; Twhite () { printf '\e[0;37m'"$*"'\e[m'; }
## ∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞ Bold Color Text ∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞ ## ∞∞∞∞∞∞∞∞∞∞∞∞ Underlined Color Text ∞∞∞∞∞∞∞∞∞∞∞∞∞ ##
TblackB () { printf '\e[1;30m'"$*"'\e[m'; } ; TblackU () { printf '\e[4;30m'"$*"'\e[m'; }
TgreyB () { printf '\e[1;30m'"$*"'\e[m'; } ; TredU () { printf '\e[4;31m'"$*"'\e[m'; }
TredB () { printf '\e[1;31m'"$*"'\e[m'; } ; TgreenU () { printf '\e[4;32m'"$*"'\e[m'; }
TgreenB () { printf '\e[1;32m'"$*"'\e[m'; } ; TbrownU () { printf '\e[4;33m'"$*"'\e[m'; }
TbrownB () { printf '\e[1;33m'"$*"'\e[m'; } ; TyellowU () { printf '\e[4;33m'"$*"'\e[m'; }
TyellowB () { printf '\e[1;33m'"$*"'\e[m'; } ; TblueU () { printf '\e[4;34m'"$*"'\e[m'; }
TblueB () { printf '\e[1;34m'"$*"'\e[m'; } ; TmagentaU () { printf '\e[4;35m'"$*"'\e[m'; }
TmagentaB () { printf '\e[1;35m'"$*"'\e[m'; } ; TpurpleU () { printf '\e[4;35m'"$*"'\e[m'; }
TpurpleB () { printf '\e[1;35m'"$*"'\e[m'; } ; TaquaU () { printf '\e[4;36m'"$*"'\e[m'; }
TaquaB () { printf '\e[1;36m'"$*"'\e[m'; } ; TcyanU () { printf '\e[4;36m'"$*"'\e[m'; }
TcyanB () { printf '\e[1;36m'"$*"'\e[m'; } ; TgreyU () { printf '\e[4;37m'"$*"'\e[m'; }
TwhiteB () { printf '\e[1;37m'"$*"'\e[m'; } ; TwhiteU () { printf '\e[4;37m'"$*"'\e[m'; }
## ∞∞∞∞∞∞∞∞∞∞∞∞∞ Flashing Color Text ∞∞∞∞∞∞∞∞∞∞∞∞∞∞ ## ∞∞∞∞∞∞∞∞∞∞∞∞∞ Inverted Color Text ∞∞∞∞∞∞∞∞∞∞∞∞∞∞ ##
TblackF () { printf '\e[5;30m'"$*"'\e[m'; } ; TblackI () { printf '\e[7;40m'"$*"'\e[m'; }
TredF () { printf '\e[5;31m'"$*"'\e[m'; } ; TredI () { printf '\e[7;41m'"$*"'\e[m'; }
TgreenF () { printf '\e[5;32m'"$*"'\e[m'; } ; TgreenI () { printf '\e[7;42m'"$*"'\e[m'; }
TbrownF () { printf '\e[5;33m'"$*"'\e[m'; } ; TbrownI () { printf '\e[7;43m'"$*"'\e[m'; }
TyellowF () { printf '\e[5;33m'"$*"'\e[m'; } ; TyellowI () { printf '\e[7;43m'"$*"'\e[m'; }
TblueF () { printf '\e[5;34m'"$*"'\e[m'; } ; TblueI () { printf '\e[7;44m'"$*"'\e[m'; }
TmagentaF () { printf '\e[5;35m'"$*"'\e[m'; } ; TmagentaI () { printf '\e[7;45m'"$*"'\e[m'; }
TpurpleF () { printf '\e[5;35m'"$*"'\e[m'; } ; TpurpleI () { printf '\e[7;45m'"$*"'\e[m'; }
TaquaF () { printf '\e[5;36m'"$*"'\e[m'; } ; TaquaI () { printf '\e[7;46m'"$*"'\e[m'; }
TcyanF () { printf '\e[5;36m'"$*"'\e[m'; } ; TcyanI () { printf '\e[7;46m'"$*"'\e[m'; }
TgreyF () { printf '\e[5;37m'"$*"'\e[m'; } ; TgreyI () { printf '\e[7;47m'"$*"'\e[m'; }
TwhiteF () { printf '\e[5;37m'"$*"'\e[m'; } ; TwhiteI () { printf '\e[7;47m'"$*"'\e[m'; }
## ∞∞∞∞∞∞∞∞∞∞∞∞∞ Invisible Color Text ∞∞∞∞∞∞∞∞∞∞∞∞∞ ## ∞∞∞∞∞∞∞∞ Plain Text on Color Background ∞∞∞∞∞∞∞∞ ##
TblackV () { printf '\e[8;30m'"$*"'\e[m'; } ; Bblack () { printf '\e[m'"$*"'\e[m'; }
TredV () { printf '\e[8;31m'"$*"'\e[m'; } ; Bred () { printf '\e[0;41m'"$*"'\e[m'; }
TgreenV () { printf '\e[8;32m'"$*"'\e[m'; } ; Bgreen () { printf '\e[0;42m'"$*"'\e[m'; }
TbrownV () { printf '\e[8;33m'"$*"'\e[m'; } ; Bbrown () { printf '\e[0;43m'"$*"'\e[m'; }
TyellowV () { printf '\e[8;33m'"$*"'\e[m'; } ; Byellow () { printf '\e[0;43m'"$*"'\e[m'; }
TblueV () { printf '\e[8;34m'"$*"'\e[m'; } ; Bblue () { printf '\e[0;44m'"$*"'\e[m'; }
TmagentaV () { printf '\e[8;35m'"$*"'\e[m'; } ; Bmagenta () { printf '\e[0;45m'"$*"'\e[m'; }
TpurpleV () { printf '\e[8;35m'"$*"'\e[m'; } ; Bpurple () { printf '\e[0;45m'"$*"'\e[m'; }
TaquaV () { printf '\e[8;36m'"$*"'\e[m'; } ; Baqua () { printf '\e[0;46m'"$*"'\e[m'; }
TcyanV () { printf '\e[8;36m'"$*"'\e[m'; } ; Bcyan () { printf '\e[0;46m'"$*"'\e[m'; }
TgreyV () { printf '\e[8;37m'"$*"'\e[m'; } ; Bgrey () { printf '\e[0;47m'"$*"'\e[m'; }
TwhiteV () { printf '\e[8;37m'"$*"'\e[m'; } ; Bwhite () { printf '\e[0;47m'"$*"'\e[m'; }
## ∞∞∞∞∞∞∞∞∞ Bold Text on Color Background ∞∞∞∞∞∞∞∞ ## ∞∞∞∞∞∞ Underlined Text on Color Background ∞∞∞∞∞ ##
BblackB () { printf '\e[1;40m'"$*"'\e[m'; } ; BblackU () { printf '\e[4;40m'"$*"'\e[m'; }
BredB () { printf '\e[1;41m'"$*"'\e[m'; } ; BredU () { printf '\e[4;41m'"$*"'\e[m'; }
BgreenB () { printf '\e[1;42m'"$*"'\e[m'; } ; BgreenU () { printf '\e[4;42m'"$*"'\e[m'; }
BbrownB () { printf '\e[1;43m'"$*"'\e[m'; } ; BbrownU () { printf '\e[4;43m'"$*"'\e[m'; }
ByellowB () { printf '\e[1;43m'"$*"'\e[m'; } ; ByellowU () { printf '\e[4;43m'"$*"'\e[m'; }
BblueB () { printf '\e[1;44m'"$*"'\e[m'; } ; BblueU () { printf '\e[4;44m'"$*"'\e[m'; }
BmagentaB () { printf '\e[1;45m'"$*"'\e[m'; } ; BmagentaU () { printf '\e[4;45m'"$*"'\e[m'; }
BpurpleB () { printf '\e[1;45m'"$*"'\e[m'; } ; BpurpleU () { printf '\e[4;45m'"$*"'\e[m'; }
BaquaB () { printf '\e[1;46m'"$*"'\e[m'; } ; BaquaU () { printf '\e[4;46m'"$*"'\e[m'; }
BcyanB () { printf '\e[1;46m'"$*"'\e[m'; } ; BcyanU () { printf '\e[4;46m'"$*"'\e[m'; }
BgreyB () { printf '\e[1;47m'"$*"'\e[m'; } ; BgreyU () { printf '\e[4;47m'"$*"'\e[m'; }
BwhiteB () { printf '\e[1;47m'"$*"'\e[m'; } ; BwhiteU () { printf '\e[4;47m'"$*"'\e[m'; }
## ∞∞∞∞∞∞∞ Flashing Text on Color Background ∞∞∞∞∞∞ ## ∞∞∞∞∞∞∞ Inverted Text on Color Background ∞∞∞∞∞∞ ##
BblackF () { printf '\e[5;40m'"$*"'\e[m'; } ; BblackI () { printf '\e[7;30m'"$*"'\e[m'; }
BredF () { printf '\e[5;41m'"$*"'\e[m'; } ; BredI () { printf '\e[7;31m'"$*"'\e[m'; }
BgreenF () { printf '\e[5;42m'"$*"'\e[m'; } ; BgreenI () { printf '\e[7;32m'"$*"'\e[m'; }
BbrownF () { printf '\e[5;43m'"$*"'\e[m'; } ; BbrownI () { printf '\e[7;33m'"$*"'\e[m'; }
ByellowF () { printf '\e[5;43m'"$*"'\e[m'; } ; ByellowI () { printf '\e[7;33m'"$*"'\e[m'; }
BblueF () { printf '\e[5;44m'"$*"'\e[m'; } ; BblueI () { printf '\e[7;34m'"$*"'\e[m'; }
BmagentaF () { printf '\e[5;45m'"$*"'\e[m'; } ; BmagentaI () { printf '\e[7;35m'"$*"'\e[m'; }
BpurpleF () { printf '\e[5;45m'"$*"'\e[m'; } ; BpurpleI () { printf '\e[7;35m'"$*"'\e[m'; }
BaquaF () { printf '\e[5;46m'"$*"'\e[m'; } ; BaquaI () { printf '\e[7;36m'"$*"'\e[m'; }
BcyanF () { printf '\e[5;46m'"$*"'\e[m'; } ; BcyanI () { printf '\e[7;36m'"$*"'\e[m'; }
BgreyF () { printf '\e[5;47m'"$*"'\e[m'; } ; BgreyI () { printf '\e[7;37m'"$*"'\e[m'; }
BwhiteF () { printf '\e[5;47m'"$*"'\e[m'; } ; BwhiteI () { printf '\e[7;37m'"$*"'\e[m'; }
## ∞∞∞∞∞∞ Invisible Text on Color Background ∞∞∞∞∞∞ ## ∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞ Color Code Notes ∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞ ##
BblackV () { printf '\e[8;40m'"$*"'\e[m'; } ## Unless I missed something or made a mistake, I ##
BredV () { printf '\e[8;41m'"$*"'\e[m'; } ## calculate a total of 7681 different color codes, ##
BgreenV () { printf '\e[8;42m'"$*"'\e[m'; } ## none of which produce a duplicate result. ##
BbrownV () { printf '\e[8;43m'"$*"'\e[m'; } ## These will be fine for now. ##
ByellowV () { printf '\e[8;43m'"$*"'\e[m'; }
BblueV () { printf '\e[8;44m'"$*"'\e[m'; }
BmagentaV () { printf '\e[8;45m'"$*"'\e[m'; }
BpurpleV () { printf '\e[8;45m'"$*"'\e[m'; }
BaquaV () { printf '\e[8;46m'"$*"'\e[m'; }
BcyanV () { printf '\e[8;46m'"$*"'\e[m'; }
BgreyV () { printf '\e[8;47m'"$*"'\e[m'; }
BwhiteV () { printf '\e[8;47m'"$*"'\e[m'; }
## ∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞ ##
The only thing to keep in mind is when wanting a `%` percent sign or a `\` backslash, you need to double them up inside:<BR>
like: `printf "$(Tblue "%%s")\n" 'hi'` <BR>
but not for `Tblue "%s\n" 'hi'`<BR>
or `printf "$(Tblue "%s" 'hi')\n"`<BR>
Since these use printf, you can do stuff like:
printf "hi $(Tred there) man $(BaquaI "%c" '!') $(Bold 'This \\t is %%s') %s\n" "$(BgreenB 'super')" "$(Bblue mega Colorful)"
or in an echo:
echo "hi $(Tred there) man $(BaquaI "%c" '!') $(Bold 'This \\t is %s' "$(BblackB 'super')") $(Bblue mega Colorful)"
A more useful example:
printf "\t%s Volume \"%s\" is not connected.\n" "$(TwhiteB [)$(TredB Error)$(TwhiteB \]:)" "$(Tbrown $Volume)"
Or with other commands:
eval "echo 'This is OSX' | sed 's:OSX:$(Invert [)$(TaquaF OSX)$(Invert ]):'"
Or something with a bit more swank:
find . -exec stat -f "Name: $(Tbrown %%N)%t%t$(Tpurple "->")%tPermissions: $(Tgreen %%Sp)" {} \;
Use your imagination! Feel free all to use these...
**Some may say, what's the use of invisible text?**<BR>
–– Not much, really... but it's there. I have used it a few times, but only to line up text when <I>"drawing"</I> with Unicode characters...
<HR>
<H2>Now for my questions...</H2>
<STRONG>1) The meta-question:</STRONG> If anyone out there feels like typing up a continuation of what I've started, can you please use the format above? or at least a similar format? Some examples are:
TgreenBU ## Bold, underlined, green text ##
TcyanBUFBblackI ## Bold cyan/aqua text that's underlined and flashing on an inverted black background ##
And so on... make up your own names so that it's possible to have all the permutations with minimal, yet clear parameter names. These are examples, but I haven't looked to see if these names conflict with others...
If someone out there likes these functions, uses them regularly, has some time, and woud like to give back something, can this mythical person please **post them for me on this question as a reply or email them to me at *[mdouglas34@hotmail.com]*[1]**. I'm too lazy to type up <I>all</I> the possibilities (I've quickly calculated over 7000 of them, but there may be many, many more if I missed something).<BR>
<STRONG>2) The main question:</STRONG> Since I use these **`Color Functions`** all the time... in every script, I need to know something about another user's terminal:<BR>
**Is there any way to determine the background color of a terminal** (without looking at it directly obviously)?<BR><BR>
**Can any other information be gleaned? Like if the terminal is set to handle colors? Perhaps their LSCOLORS or something to give hints at their terminal capabilities/settings?** I guess `$TERM` if set to `xterm-color`, that's a dead giveaway that colors are possible... but what are the capabilities of other terminals? Can `rxvt` produce the same colors? How is `xterm-256color` relate to this? can more colors be used than the standard 8? and 8 bold?<BR>
basically, I want to write code that spits out color output and is suitable on any system running any terminal, with any setting. **Is there any way to get this information or is this only a pipe dream?**
Finally... **What about fonts? do all terminals use proportional/monospaced fonts? Is there any way to determine if a user has, say, unicode support?** It would be nice to konw if certain pretty yet fancy characters are not going to display property as they could be swapped with uglier, yet simpler characters.<BR><BR>
<H4>So basically, I'm looking for many ways to scan a non-local user's settings, environment, so that pretty-print code would be ported elsewhere.</H4>
Is there software writted for this purpose out there that I don't know of?
Sorry for all the questions... some precise, others a bit vague... I hope there will be lots of answers for me to pool together. Porting pretty-print is a major challenge in the unix world... I hope to make a dent in this battleship of a problem.
In the mean time all, feel free all to use my `Color Functions` as you see fit!
Enjoy!
-- <B><I>Aesthir</I></B>
[1]: http://mdouglas34@hotmail.com | bash | shell | colors | portability | pretty-print | null | open | Colorize text/background, how to make pretty-print portable? Also, large list of Color Functions written by Aesthir, enjoy?
===
Although this isn't a specific question, I do have one.... but first, I'd like to share `[ Aesthir's Color Functions™ ]`... —— it's not really trademarked ;^) —— with all the shell-coders out there who would like things to look a bit nicer. I use these religiously throughout all my scripts (70+ now), just for fun, to easily separate data and to organize better.
Below are the color functions that I use regularly... wrote them years ago and have gotten so used to them that they're a regular part of my scripting. They function as `printf` substitutes, so rather than boring old `printf "Hello\n"`, a green hello simply `Tgreen "Hello\n"` Just stick this code block into your .bashrc file, start a new session, and you're set! Hell stick some into your PSn variables for easy color prompts. For instance, here is my select prompt: `export PS3="$(Tmagenta ' 〔Select〕 ')"`, and my sudo prompt: `export SUDO_PROMPT=" $(Tgreen '〔Password〕') "`. These are the ones I use:
<HR>
## ∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞ ##
## ∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞ [ Aesthir's Color Functions ] ∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞ ##
## ∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞ ##
Normal () { printf '\e[m'"$*"; } ; Tblack () { printf '\e[0;30m'"$*"'\e[m'; }
TNormal () { printf '\e[m'"$*"; } ; Tred () { printf '\e[0;31m'"$*"'\e[m'; }
Bold () { printf '\e[1m'"$*"'\e[m'; } ; Tgreen () { printf '\e[0;32m'"$*"'\e[m'; }
TBold () { printf '\e[1m'"$*"'\e[m'; } ; Tbrown () { printf '\e[0;33m'"$*"'\e[m'; }
Underline () { printf '\e[4m'"$*"'\e[m'; } ; Tyellow () { printf '\e[0;33m'"$*"'\e[m'; }
TUnderline () { printf '\e[4m'"$*"'\e[m'; } ; Tblue () { printf '\e[0;34m'"$*"'\e[m'; }
Flash () { printf '\e[5m'"$*"'\e[m'; } ; Tmagenta () { printf '\e[0;35m'"$*"'\e[m'; }
TFlash () { printf '\e[5m'"$*"'\e[m'; } ; Tpurple () { printf '\e[0;35m'"$*"'\e[m'; }
Invert () { printf '\e[7m'"$*"'\e[m'; } ; Taqua () { printf '\e[0;36m'"$*"'\e[m'; }
TInvert () { printf '\e[7m'"$*"'\e[m'; } ; Tcyan () { printf '\e[0;36m'"$*"'\e[m'; }
Invisible () { printf '\e[8m'"$*"'\e[m'; } ; Tgrey () { printf '\e[0;37m'"$*"'\e[m'; }
TInvisible () { printf '\e[8m'"$*"'\e[m'; } ; Twhite () { printf '\e[0;37m'"$*"'\e[m'; }
## ∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞ Bold Color Text ∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞ ## ∞∞∞∞∞∞∞∞∞∞∞∞ Underlined Color Text ∞∞∞∞∞∞∞∞∞∞∞∞∞ ##
TblackB () { printf '\e[1;30m'"$*"'\e[m'; } ; TblackU () { printf '\e[4;30m'"$*"'\e[m'; }
TgreyB () { printf '\e[1;30m'"$*"'\e[m'; } ; TredU () { printf '\e[4;31m'"$*"'\e[m'; }
TredB () { printf '\e[1;31m'"$*"'\e[m'; } ; TgreenU () { printf '\e[4;32m'"$*"'\e[m'; }
TgreenB () { printf '\e[1;32m'"$*"'\e[m'; } ; TbrownU () { printf '\e[4;33m'"$*"'\e[m'; }
TbrownB () { printf '\e[1;33m'"$*"'\e[m'; } ; TyellowU () { printf '\e[4;33m'"$*"'\e[m'; }
TyellowB () { printf '\e[1;33m'"$*"'\e[m'; } ; TblueU () { printf '\e[4;34m'"$*"'\e[m'; }
TblueB () { printf '\e[1;34m'"$*"'\e[m'; } ; TmagentaU () { printf '\e[4;35m'"$*"'\e[m'; }
TmagentaB () { printf '\e[1;35m'"$*"'\e[m'; } ; TpurpleU () { printf '\e[4;35m'"$*"'\e[m'; }
TpurpleB () { printf '\e[1;35m'"$*"'\e[m'; } ; TaquaU () { printf '\e[4;36m'"$*"'\e[m'; }
TaquaB () { printf '\e[1;36m'"$*"'\e[m'; } ; TcyanU () { printf '\e[4;36m'"$*"'\e[m'; }
TcyanB () { printf '\e[1;36m'"$*"'\e[m'; } ; TgreyU () { printf '\e[4;37m'"$*"'\e[m'; }
TwhiteB () { printf '\e[1;37m'"$*"'\e[m'; } ; TwhiteU () { printf '\e[4;37m'"$*"'\e[m'; }
## ∞∞∞∞∞∞∞∞∞∞∞∞∞ Flashing Color Text ∞∞∞∞∞∞∞∞∞∞∞∞∞∞ ## ∞∞∞∞∞∞∞∞∞∞∞∞∞ Inverted Color Text ∞∞∞∞∞∞∞∞∞∞∞∞∞∞ ##
TblackF () { printf '\e[5;30m'"$*"'\e[m'; } ; TblackI () { printf '\e[7;40m'"$*"'\e[m'; }
TredF () { printf '\e[5;31m'"$*"'\e[m'; } ; TredI () { printf '\e[7;41m'"$*"'\e[m'; }
TgreenF () { printf '\e[5;32m'"$*"'\e[m'; } ; TgreenI () { printf '\e[7;42m'"$*"'\e[m'; }
TbrownF () { printf '\e[5;33m'"$*"'\e[m'; } ; TbrownI () { printf '\e[7;43m'"$*"'\e[m'; }
TyellowF () { printf '\e[5;33m'"$*"'\e[m'; } ; TyellowI () { printf '\e[7;43m'"$*"'\e[m'; }
TblueF () { printf '\e[5;34m'"$*"'\e[m'; } ; TblueI () { printf '\e[7;44m'"$*"'\e[m'; }
TmagentaF () { printf '\e[5;35m'"$*"'\e[m'; } ; TmagentaI () { printf '\e[7;45m'"$*"'\e[m'; }
TpurpleF () { printf '\e[5;35m'"$*"'\e[m'; } ; TpurpleI () { printf '\e[7;45m'"$*"'\e[m'; }
TaquaF () { printf '\e[5;36m'"$*"'\e[m'; } ; TaquaI () { printf '\e[7;46m'"$*"'\e[m'; }
TcyanF () { printf '\e[5;36m'"$*"'\e[m'; } ; TcyanI () { printf '\e[7;46m'"$*"'\e[m'; }
TgreyF () { printf '\e[5;37m'"$*"'\e[m'; } ; TgreyI () { printf '\e[7;47m'"$*"'\e[m'; }
TwhiteF () { printf '\e[5;37m'"$*"'\e[m'; } ; TwhiteI () { printf '\e[7;47m'"$*"'\e[m'; }
## ∞∞∞∞∞∞∞∞∞∞∞∞∞ Invisible Color Text ∞∞∞∞∞∞∞∞∞∞∞∞∞ ## ∞∞∞∞∞∞∞∞ Plain Text on Color Background ∞∞∞∞∞∞∞∞ ##
TblackV () { printf '\e[8;30m'"$*"'\e[m'; } ; Bblack () { printf '\e[m'"$*"'\e[m'; }
TredV () { printf '\e[8;31m'"$*"'\e[m'; } ; Bred () { printf '\e[0;41m'"$*"'\e[m'; }
TgreenV () { printf '\e[8;32m'"$*"'\e[m'; } ; Bgreen () { printf '\e[0;42m'"$*"'\e[m'; }
TbrownV () { printf '\e[8;33m'"$*"'\e[m'; } ; Bbrown () { printf '\e[0;43m'"$*"'\e[m'; }
TyellowV () { printf '\e[8;33m'"$*"'\e[m'; } ; Byellow () { printf '\e[0;43m'"$*"'\e[m'; }
TblueV () { printf '\e[8;34m'"$*"'\e[m'; } ; Bblue () { printf '\e[0;44m'"$*"'\e[m'; }
TmagentaV () { printf '\e[8;35m'"$*"'\e[m'; } ; Bmagenta () { printf '\e[0;45m'"$*"'\e[m'; }
TpurpleV () { printf '\e[8;35m'"$*"'\e[m'; } ; Bpurple () { printf '\e[0;45m'"$*"'\e[m'; }
TaquaV () { printf '\e[8;36m'"$*"'\e[m'; } ; Baqua () { printf '\e[0;46m'"$*"'\e[m'; }
TcyanV () { printf '\e[8;36m'"$*"'\e[m'; } ; Bcyan () { printf '\e[0;46m'"$*"'\e[m'; }
TgreyV () { printf '\e[8;37m'"$*"'\e[m'; } ; Bgrey () { printf '\e[0;47m'"$*"'\e[m'; }
TwhiteV () { printf '\e[8;37m'"$*"'\e[m'; } ; Bwhite () { printf '\e[0;47m'"$*"'\e[m'; }
## ∞∞∞∞∞∞∞∞∞ Bold Text on Color Background ∞∞∞∞∞∞∞∞ ## ∞∞∞∞∞∞ Underlined Text on Color Background ∞∞∞∞∞ ##
BblackB () { printf '\e[1;40m'"$*"'\e[m'; } ; BblackU () { printf '\e[4;40m'"$*"'\e[m'; }
BredB () { printf '\e[1;41m'"$*"'\e[m'; } ; BredU () { printf '\e[4;41m'"$*"'\e[m'; }
BgreenB () { printf '\e[1;42m'"$*"'\e[m'; } ; BgreenU () { printf '\e[4;42m'"$*"'\e[m'; }
BbrownB () { printf '\e[1;43m'"$*"'\e[m'; } ; BbrownU () { printf '\e[4;43m'"$*"'\e[m'; }
ByellowB () { printf '\e[1;43m'"$*"'\e[m'; } ; ByellowU () { printf '\e[4;43m'"$*"'\e[m'; }
BblueB () { printf '\e[1;44m'"$*"'\e[m'; } ; BblueU () { printf '\e[4;44m'"$*"'\e[m'; }
BmagentaB () { printf '\e[1;45m'"$*"'\e[m'; } ; BmagentaU () { printf '\e[4;45m'"$*"'\e[m'; }
BpurpleB () { printf '\e[1;45m'"$*"'\e[m'; } ; BpurpleU () { printf '\e[4;45m'"$*"'\e[m'; }
BaquaB () { printf '\e[1;46m'"$*"'\e[m'; } ; BaquaU () { printf '\e[4;46m'"$*"'\e[m'; }
BcyanB () { printf '\e[1;46m'"$*"'\e[m'; } ; BcyanU () { printf '\e[4;46m'"$*"'\e[m'; }
BgreyB () { printf '\e[1;47m'"$*"'\e[m'; } ; BgreyU () { printf '\e[4;47m'"$*"'\e[m'; }
BwhiteB () { printf '\e[1;47m'"$*"'\e[m'; } ; BwhiteU () { printf '\e[4;47m'"$*"'\e[m'; }
## ∞∞∞∞∞∞∞ Flashing Text on Color Background ∞∞∞∞∞∞ ## ∞∞∞∞∞∞∞ Inverted Text on Color Background ∞∞∞∞∞∞ ##
BblackF () { printf '\e[5;40m'"$*"'\e[m'; } ; BblackI () { printf '\e[7;30m'"$*"'\e[m'; }
BredF () { printf '\e[5;41m'"$*"'\e[m'; } ; BredI () { printf '\e[7;31m'"$*"'\e[m'; }
BgreenF () { printf '\e[5;42m'"$*"'\e[m'; } ; BgreenI () { printf '\e[7;32m'"$*"'\e[m'; }
BbrownF () { printf '\e[5;43m'"$*"'\e[m'; } ; BbrownI () { printf '\e[7;33m'"$*"'\e[m'; }
ByellowF () { printf '\e[5;43m'"$*"'\e[m'; } ; ByellowI () { printf '\e[7;33m'"$*"'\e[m'; }
BblueF () { printf '\e[5;44m'"$*"'\e[m'; } ; BblueI () { printf '\e[7;34m'"$*"'\e[m'; }
BmagentaF () { printf '\e[5;45m'"$*"'\e[m'; } ; BmagentaI () { printf '\e[7;35m'"$*"'\e[m'; }
BpurpleF () { printf '\e[5;45m'"$*"'\e[m'; } ; BpurpleI () { printf '\e[7;35m'"$*"'\e[m'; }
BaquaF () { printf '\e[5;46m'"$*"'\e[m'; } ; BaquaI () { printf '\e[7;36m'"$*"'\e[m'; }
BcyanF () { printf '\e[5;46m'"$*"'\e[m'; } ; BcyanI () { printf '\e[7;36m'"$*"'\e[m'; }
BgreyF () { printf '\e[5;47m'"$*"'\e[m'; } ; BgreyI () { printf '\e[7;37m'"$*"'\e[m'; }
BwhiteF () { printf '\e[5;47m'"$*"'\e[m'; } ; BwhiteI () { printf '\e[7;37m'"$*"'\e[m'; }
## ∞∞∞∞∞∞ Invisible Text on Color Background ∞∞∞∞∞∞ ## ∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞ Color Code Notes ∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞ ##
BblackV () { printf '\e[8;40m'"$*"'\e[m'; } ## Unless I missed something or made a mistake, I ##
BredV () { printf '\e[8;41m'"$*"'\e[m'; } ## calculate a total of 7681 different color codes, ##
BgreenV () { printf '\e[8;42m'"$*"'\e[m'; } ## none of which produce a duplicate result. ##
BbrownV () { printf '\e[8;43m'"$*"'\e[m'; } ## These will be fine for now. ##
ByellowV () { printf '\e[8;43m'"$*"'\e[m'; }
BblueV () { printf '\e[8;44m'"$*"'\e[m'; }
BmagentaV () { printf '\e[8;45m'"$*"'\e[m'; }
BpurpleV () { printf '\e[8;45m'"$*"'\e[m'; }
BaquaV () { printf '\e[8;46m'"$*"'\e[m'; }
BcyanV () { printf '\e[8;46m'"$*"'\e[m'; }
BgreyV () { printf '\e[8;47m'"$*"'\e[m'; }
BwhiteV () { printf '\e[8;47m'"$*"'\e[m'; }
## ∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞ ##
The only thing to keep in mind is when wanting a `%` percent sign or a `\` backslash, you need to double them up inside:<BR>
like: `printf "$(Tblue "%%s")\n" 'hi'` <BR>
but not for `Tblue "%s\n" 'hi'`<BR>
or `printf "$(Tblue "%s" 'hi')\n"`<BR>
Since these use printf, you can do stuff like:
printf "hi $(Tred there) man $(BaquaI "%c" '!') $(Bold 'This \\t is %%s') %s\n" "$(BgreenB 'super')" "$(Bblue mega Colorful)"
or in an echo:
echo "hi $(Tred there) man $(BaquaI "%c" '!') $(Bold 'This \\t is %s' "$(BblackB 'super')") $(Bblue mega Colorful)"
A more useful example:
printf "\t%s Volume \"%s\" is not connected.\n" "$(TwhiteB [)$(TredB Error)$(TwhiteB \]:)" "$(Tbrown $Volume)"
Or with other commands:
eval "echo 'This is OSX' | sed 's:OSX:$(Invert [)$(TaquaF OSX)$(Invert ]):'"
Or something with a bit more swank:
find . -exec stat -f "Name: $(Tbrown %%N)%t%t$(Tpurple "->")%tPermissions: $(Tgreen %%Sp)" {} \;
Use your imagination! Feel free all to use these...
**Some may say, what's the use of invisible text?**<BR>
–– Not much, really... but it's there. I have used it a few times, but only to line up text when <I>"drawing"</I> with Unicode characters...
<HR>
<H2>Now for my questions...</H2>
<STRONG>1) The meta-question:</STRONG> If anyone out there feels like typing up a continuation of what I've started, can you please use the format above? or at least a similar format? Some examples are:
TgreenBU ## Bold, underlined, green text ##
TcyanBUFBblackI ## Bold cyan/aqua text that's underlined and flashing on an inverted black background ##
And so on... make up your own names so that it's possible to have all the permutations with minimal, yet clear parameter names. These are examples, but I haven't looked to see if these names conflict with others...
If someone out there likes these functions, uses them regularly, has some time, and woud like to give back something, can this mythical person please **post them for me on this question as a reply or email them to me at *[mdouglas34@hotmail.com]*[1]**. I'm too lazy to type up <I>all</I> the possibilities (I've quickly calculated over 7000 of them, but there may be many, many more if I missed something).<BR>
<STRONG>2) The main question:</STRONG> Since I use these **`Color Functions`** all the time... in every script, I need to know something about another user's terminal:<BR>
**Is there any way to determine the background color of a terminal** (without looking at it directly obviously)?<BR><BR>
**Can any other information be gleaned? Like if the terminal is set to handle colors? Perhaps their LSCOLORS or something to give hints at their terminal capabilities/settings?** I guess `$TERM` if set to `xterm-color`, that's a dead giveaway that colors are possible... but what are the capabilities of other terminals? Can `rxvt` produce the same colors? How is `xterm-256color` relate to this? can more colors be used than the standard 8? and 8 bold?<BR>
basically, I want to write code that spits out color output and is suitable on any system running any terminal, with any setting. **Is there any way to get this information or is this only a pipe dream?**
Finally... **What about fonts? do all terminals use proportional/monospaced fonts? Is there any way to determine if a user has, say, unicode support?** It would be nice to konw if certain pretty yet fancy characters are not going to display property as they could be swapped with uglier, yet simpler characters.<BR><BR>
<H4>So basically, I'm looking for many ways to scan a non-local user's settings, environment, so that pretty-print code would be ported elsewhere.</H4>
Is there software writted for this purpose out there that I don't know of?
Sorry for all the questions... some precise, others a bit vague... I hope there will be lots of answers for me to pool together. Porting pretty-print is a major challenge in the unix world... I hope to make a dent in this battleship of a problem.
In the mean time all, feel free all to use my `Color Functions` as you see fit!
Enjoy!
-- <B><I>Aesthir</I></B>
[1]: http://mdouglas34@hotmail.com | 0 |
7,326,441 | 09/06/2011 21:34:11 | 329,700 | 04/30/2010 11:12:27 | 882 | 19 | File contains two EOF characters; what happens? | Will this screw up file size estimation on the file system? Will the filesystem overwrite everything past the first EOF character? How is this handled? | unix | eof | null | null | null | null | open | File contains two EOF characters; what happens?
===
Will this screw up file size estimation on the file system? Will the filesystem overwrite everything past the first EOF character? How is this handled? | 0 |
3,414,362 | 08/05/2010 11:51:32 | 411,908 | 08/05/2010 11:48:12 | 1 | 0 | what are the concepts i want to study for web designing | i want to become a web designer so what are the concepts i want to study | website-designing | null | null | null | null | 08/05/2010 12:14:33 | off topic | what are the concepts i want to study for web designing
===
i want to become a web designer so what are the concepts i want to study | 2 |
6,906,314 | 08/02/2011 01:18:34 | 576,638 | 01/15/2011 10:21:09 | 161 | 8 | php abbreviating numbers with K/M | The function below finds the number, rounds it off and puts a K or M on the end of it
IE: 25000 becomes 25K
function abbr_no($number) {
$number = preg_replace('/[^0-9]/', '', $number);
$numbers = array('', 'K', 'M');
if ($number == 0) {
return('n/a');
} else {
return (round($number/pow(10000, ($i = floor(log($number, 10000)))), 0) . $numbers[$i]);
}
}
and so it basically does what I want, but as is for a number like *389345* it rounds it off and spits out *39K* (as it should) however I would like the result to be *398K* (3 digit number)
Now in the last return line:
0) . $numbers[$i]);
if I change the 0 to a 1 the result becomes *39.8K* but again I don't want the decimal point so I am currently stuck and have hit a brickwall
As always all help is appreciated and thank you in advance. | php | function | numbers | abbreviation | null | null | open | php abbreviating numbers with K/M
===
The function below finds the number, rounds it off and puts a K or M on the end of it
IE: 25000 becomes 25K
function abbr_no($number) {
$number = preg_replace('/[^0-9]/', '', $number);
$numbers = array('', 'K', 'M');
if ($number == 0) {
return('n/a');
} else {
return (round($number/pow(10000, ($i = floor(log($number, 10000)))), 0) . $numbers[$i]);
}
}
and so it basically does what I want, but as is for a number like *389345* it rounds it off and spits out *39K* (as it should) however I would like the result to be *398K* (3 digit number)
Now in the last return line:
0) . $numbers[$i]);
if I change the 0 to a 1 the result becomes *39.8K* but again I don't want the decimal point so I am currently stuck and have hit a brickwall
As always all help is appreciated and thank you in advance. | 0 |
2,274,769 | 02/16/2010 17:12:19 | 251,848 | 01/15/2010 20:35:01 | 600 | 15 | C++ pointers to class instances | I have an (for C++ programmers better than me) simple problem with classes and pointers.
I thought about posting example code describing my problem but I found it easier to just explain it in words.
Assuming I have three classes:
- **Class A:** The main class - it contains an instance of both `B` and `C`.
- **Class B:** This class contains a method that outputs some string, call it `Greet()`.
- **Class C:** This one has a method too, but that method has to call `Greet()` in the instance of `B` that is located in class `A`. Let's name it `DoSomethingWithB()`
So the program starts, in the main function I create an instance of `A`. `A`, again, creates instances of `B` and `C`. Then, A calls `C.DoSomethingWithB();`.
And there my problem begins: I can't access `B` from inside `C`.
Obviously, I will need to pass a pointer to `B` to the `DoSomethingWithB()` function so that I can call `B.Greet()` from inside `C`
Long explanation, short question: **How do I do this?**
Example code incoming:
#include <iostream>
using namespace std;
class B
{
public:
void Greet( )
{
cout<<"Hello Pointer!"<<endl;
}
};
class C
{
public:
void DoSomethingWithB( )
{
// ... b.Greet( ); Won't work obviously
}
};
class A
{
public:
B b; // Not caring about visibility or bad class/variable names here
C c;
void StartTest( )
{
c.DoSomethingWithB( );
}
};
int main( )
{
A mainInstance;
mainInstance.StartTest();
}
| c++ | pointers | null | null | null | null | open | C++ pointers to class instances
===
I have an (for C++ programmers better than me) simple problem with classes and pointers.
I thought about posting example code describing my problem but I found it easier to just explain it in words.
Assuming I have three classes:
- **Class A:** The main class - it contains an instance of both `B` and `C`.
- **Class B:** This class contains a method that outputs some string, call it `Greet()`.
- **Class C:** This one has a method too, but that method has to call `Greet()` in the instance of `B` that is located in class `A`. Let's name it `DoSomethingWithB()`
So the program starts, in the main function I create an instance of `A`. `A`, again, creates instances of `B` and `C`. Then, A calls `C.DoSomethingWithB();`.
And there my problem begins: I can't access `B` from inside `C`.
Obviously, I will need to pass a pointer to `B` to the `DoSomethingWithB()` function so that I can call `B.Greet()` from inside `C`
Long explanation, short question: **How do I do this?**
Example code incoming:
#include <iostream>
using namespace std;
class B
{
public:
void Greet( )
{
cout<<"Hello Pointer!"<<endl;
}
};
class C
{
public:
void DoSomethingWithB( )
{
// ... b.Greet( ); Won't work obviously
}
};
class A
{
public:
B b; // Not caring about visibility or bad class/variable names here
C c;
void StartTest( )
{
c.DoSomethingWithB( );
}
};
int main( )
{
A mainInstance;
mainInstance.StartTest();
}
| 0 |
6,910,511 | 08/02/2011 10:20:13 | 7,604 | 09/15/2008 14:02:40 | 148 | 2 | What PHP framework would you choose for a new Facebook application and why? | Considering facebook application is to be developed in PHP, which PHP framework (code igniter, Yii, cake php etc.) would you use? | php | facebook | frameworks | null | null | 08/02/2011 11:08:24 | not constructive | What PHP framework would you choose for a new Facebook application and why?
===
Considering facebook application is to be developed in PHP, which PHP framework (code igniter, Yii, cake php etc.) would you use? | 4 |
8,905,007 | 01/18/2012 04:01:48 | 474,009 | 10/13/2010 03:04:11 | 528 | 14 | What is the oposite of pop on a ruby array? | I have a array:
a = ['a', 'b', 'c']
a.pop return 'c', what would return 'a'? | ruby | null | null | null | null | 01/18/2012 12:55:11 | not a real question | What is the oposite of pop on a ruby array?
===
I have a array:
a = ['a', 'b', 'c']
a.pop return 'c', what would return 'a'? | 1 |
10,615,510 | 05/16/2012 09:19:56 | 345,859 | 05/20/2010 08:06:31 | 438 | 1 | How come python did not refer to this very simple scenario? | How come python did not refer to this so basic scenario?
[handling multiple modules versions][1]
[1]: http://stackoverflow.com/questions/6570635/how-to-deal-pip-install-multiple-package-versions
How come i need to deal with it by myself? when in java i have the maven product to do all this work for me??? | python | maven | null | null | null | 05/16/2012 10:08:26 | not a real question | How come python did not refer to this very simple scenario?
===
How come python did not refer to this so basic scenario?
[handling multiple modules versions][1]
[1]: http://stackoverflow.com/questions/6570635/how-to-deal-pip-install-multiple-package-versions
How come i need to deal with it by myself? when in java i have the maven product to do all this work for me??? | 1 |
4,211,748 | 11/18/2010 04:44:07 | 224,988 | 12/04/2009 18:31:03 | 2,305 | 109 | Autorun for Mac? | I've got a Flash projector which I plan to distribute on CD. I'm making a projector for Mac and Windows. I know how to do Autorun on Windows, but I want to do so on Mac as well.
How does that work? | osx | autorun | projector | null | null | null | open | Autorun for Mac?
===
I've got a Flash projector which I plan to distribute on CD. I'm making a projector for Mac and Windows. I know how to do Autorun on Windows, but I want to do so on Mac as well.
How does that work? | 0 |
8,780,949 | 01/08/2012 20:23:04 | 937,624 | 09/09/2011 22:09:13 | 334 | 0 | Making a good code structure | What do you say about the code structure below? This is one of the recommended ways of writing JS code in my education.
What is the pros and cons with writing code this way?
Can you recommend any better and maybe more elegant ways of writing code?
var DESKTOP = DESKTOP || {};
DESKTOP.Init = DESKTOP.Init || {};
DESKTOP.Windows = DESKTOP.Windows || {};
DESKTOP.desktop = DESKTOP.desktop || {};
DESKTOP.Windows = function(width, height){
this.width = width;
this.height = height;
};
DESKTOP.Windows.prototype.buildWindow = function(){
// code here...
};
DESKTOP.Windows.prototype.showMenu = function(text){
// code here...
};
DESKTOP.Windows.bgChange = function(width, height){
DESKTOP.Windows.call(this, width, height);
this.content = 'the content';
this.title = 'the title'
};
DESKTOP.Windows.bgChange.prototype = new DESKTOP.Windows();
DESKTOP.Windows.bgChange.prototype.loadImages = function(){
// code here...
};
DESKTOP.Desktop = function(){
// code here...
};
and so on...
| javascript | code-structure | null | null | null | 01/08/2012 20:31:22 | off topic | Making a good code structure
===
What do you say about the code structure below? This is one of the recommended ways of writing JS code in my education.
What is the pros and cons with writing code this way?
Can you recommend any better and maybe more elegant ways of writing code?
var DESKTOP = DESKTOP || {};
DESKTOP.Init = DESKTOP.Init || {};
DESKTOP.Windows = DESKTOP.Windows || {};
DESKTOP.desktop = DESKTOP.desktop || {};
DESKTOP.Windows = function(width, height){
this.width = width;
this.height = height;
};
DESKTOP.Windows.prototype.buildWindow = function(){
// code here...
};
DESKTOP.Windows.prototype.showMenu = function(text){
// code here...
};
DESKTOP.Windows.bgChange = function(width, height){
DESKTOP.Windows.call(this, width, height);
this.content = 'the content';
this.title = 'the title'
};
DESKTOP.Windows.bgChange.prototype = new DESKTOP.Windows();
DESKTOP.Windows.bgChange.prototype.loadImages = function(){
// code here...
};
DESKTOP.Desktop = function(){
// code here...
};
and so on...
| 2 |
10,903,083 | 06/05/2012 18:48:16 | 1,406,214 | 05/20/2012 12:27:13 | 23 | 1 | c# winforms how to multiply string array members? | First, i need to create a string array from DataGridView.SelectedCells.Values<br/><br/>
Then I need to multiplay that string - by istself, until a limit of member.count is riched.<br/><br/>
for example:<br/><br/>
if string [a] = {"a", "b", "c"}; //where abc are selectedCells.Values.<br/><br/>
new string should be: {"a", "b", "c", "a", "b", "c", "a", "b"} - if limit is 8, for exemple.<br/><br/>
How could I solve this, pls? | c# | winforms | datagridview | string-array | null | null | open | c# winforms how to multiply string array members?
===
First, i need to create a string array from DataGridView.SelectedCells.Values<br/><br/>
Then I need to multiplay that string - by istself, until a limit of member.count is riched.<br/><br/>
for example:<br/><br/>
if string [a] = {"a", "b", "c"}; //where abc are selectedCells.Values.<br/><br/>
new string should be: {"a", "b", "c", "a", "b", "c", "a", "b"} - if limit is 8, for exemple.<br/><br/>
How could I solve this, pls? | 0 |
573,837 | 02/21/2009 22:28:41 | 51,420 | 01/04/2009 18:20:58 | 160 | 11 | A shot in the dark - Application bug | Ok so this is gonna be a bit of a shot in the dark without you being able to see my application!
I have a bug. I have a SwimmingPool class, my app passes the pool from a tableview into a detail view where you can see all the swimmingPool class fields. You can then click on the individual detail, edit it, and then save it. The 'original' pool facility is copied and passed to the view controller responsible for actually making changes. If the user presses save, the fields are copied from the copy into 'original'
switch (self.sectionFromParentTable) {
case KNameIndex:
self.thePoolFacility.name = self.thePoolFacilityCopy.name;
self.thePoolFacility.type = self.thePoolFacilityCopy.type;
break;
case KAddressIndex:
self.thePoolFacility.address = self.thePoolFacilityCopy.address;
break;
case KPhoneNumberIndex:
self.thePoolFacility.phoneNumber = self.thePoolFacilityCopy.phoneNumber;
break;
case KWebAddressIndex:
self.thePoolFacility.webAddress = self.thePoolFacilityCopy.webAddress;
break;
case KPricesIndex:
self.thePoolFacility.prices = self.thePoolFacilityCopy.prices;
break;
case KPoolIndex:
self.thePoolFacility.pools = self.thePoolFacilityCopy.pools;
default:
break;
}
[self.navigationController popViewControllerAnimated:YES];
Can I have some guesses at a bug that does the following:
1. The bug results in the changes done
to a class' fields not being saved. In particular a class called TimeEntry, in a mutable array called Monday in a Dictionary called TermTimes in a class called pool and then in a mutable array called Pools.
2. It's appears random. Sometimes it
works perfectly. Sometimes it
doesn't! I can't recreate the error,
only if I'm lucky can i get it not
to save. My hunch is it could be
time sensitive. For example, If I am
entering a timetable for Pool
opening times, if i quickly add a
few entries and save it usually
works fine. If I fill in a whole
timetable then it more than not
doesn't save.
3. The app doesn't crash.
It's infuriating the try and debug an error that seems to happen at random. Any hints on such an epic bug hunt? | iphone | cocoa-touch | objective-c | memory-management | null | null | open | A shot in the dark - Application bug
===
Ok so this is gonna be a bit of a shot in the dark without you being able to see my application!
I have a bug. I have a SwimmingPool class, my app passes the pool from a tableview into a detail view where you can see all the swimmingPool class fields. You can then click on the individual detail, edit it, and then save it. The 'original' pool facility is copied and passed to the view controller responsible for actually making changes. If the user presses save, the fields are copied from the copy into 'original'
switch (self.sectionFromParentTable) {
case KNameIndex:
self.thePoolFacility.name = self.thePoolFacilityCopy.name;
self.thePoolFacility.type = self.thePoolFacilityCopy.type;
break;
case KAddressIndex:
self.thePoolFacility.address = self.thePoolFacilityCopy.address;
break;
case KPhoneNumberIndex:
self.thePoolFacility.phoneNumber = self.thePoolFacilityCopy.phoneNumber;
break;
case KWebAddressIndex:
self.thePoolFacility.webAddress = self.thePoolFacilityCopy.webAddress;
break;
case KPricesIndex:
self.thePoolFacility.prices = self.thePoolFacilityCopy.prices;
break;
case KPoolIndex:
self.thePoolFacility.pools = self.thePoolFacilityCopy.pools;
default:
break;
}
[self.navigationController popViewControllerAnimated:YES];
Can I have some guesses at a bug that does the following:
1. The bug results in the changes done
to a class' fields not being saved. In particular a class called TimeEntry, in a mutable array called Monday in a Dictionary called TermTimes in a class called pool and then in a mutable array called Pools.
2. It's appears random. Sometimes it
works perfectly. Sometimes it
doesn't! I can't recreate the error,
only if I'm lucky can i get it not
to save. My hunch is it could be
time sensitive. For example, If I am
entering a timetable for Pool
opening times, if i quickly add a
few entries and save it usually
works fine. If I fill in a whole
timetable then it more than not
doesn't save.
3. The app doesn't crash.
It's infuriating the try and debug an error that seems to happen at random. Any hints on such an epic bug hunt? | 0 |
8,713,787 | 01/03/2012 14:29:51 | 5,692 | 09/11/2008 01:00:57 | 301 | 5 | What is the correct pronunciation of the Objective-C type "id"? | I've heard it pronounced as its letters "eye-dee" and as a word that rhymes with "did", but I can't find any official reference suggesting the correct pronunciation. What is it? | objective-c | pronunciation | null | null | null | 03/14/2012 04:14:42 | off topic | What is the correct pronunciation of the Objective-C type "id"?
===
I've heard it pronounced as its letters "eye-dee" and as a word that rhymes with "did", but I can't find any official reference suggesting the correct pronunciation. What is it? | 2 |
8,833,386 | 01/12/2012 10:17:45 | 860,200 | 07/24/2011 12:20:48 | 10 | 0 | php mysql redirect image URL to link URL | some one use my image URL in his site...
i want to redirect my site image URL like this :
> mysite.com/wallpaper/image_car.jpg
redirect to
> mysite.com/wallpaper/image_car.html
when he use in his site then its redirect
i want code in php
| php | mysql | null | null | null | 01/12/2012 16:27:58 | not a real question | php mysql redirect image URL to link URL
===
some one use my image URL in his site...
i want to redirect my site image URL like this :
> mysite.com/wallpaper/image_car.jpg
redirect to
> mysite.com/wallpaper/image_car.html
when he use in his site then its redirect
i want code in php
| 1 |
3,327,860 | 07/25/2010 03:20:58 | 208,513 | 11/11/2009 08:46:16 | 116 | 7 | How to print an a 4x4 array in clockwise direction using C# | Please help..if anyone have any sample code. | c# | algorithm | data-structures | null | null | 07/25/2010 04:17:59 | not a real question | How to print an a 4x4 array in clockwise direction using C#
===
Please help..if anyone have any sample code. | 1 |
9,197,267 | 02/08/2012 16:20:12 | 1,106,441 | 12/19/2011 17:49:47 | 1 | 0 | [NSDictionary and NSMutableArray] | I have a tableView with n rows.
In each row have data such as foodID, foodPrice...
when i select one of rows in table , it will load a new window displayed info :foodID foodPrice of slected table
I think Dictionary can solove but don't know how to code it
Please help me. | iphone | null | null | null | null | 02/08/2012 16:30:31 | not a real question | [NSDictionary and NSMutableArray]
===
I have a tableView with n rows.
In each row have data such as foodID, foodPrice...
when i select one of rows in table , it will load a new window displayed info :foodID foodPrice of slected table
I think Dictionary can solove but don't know how to code it
Please help me. | 1 |
3,232,921 | 07/12/2010 22:56:53 | 125,380 | 06/18/2009 20:38:16 | 1,905 | 38 | How to eliminate Perl rounding errors | Consider the following program:
<pre>
<code>
$x=12345678901.234567000;
$y=($x-int($x))*1000000000;
printf("%f:%f\n",$x,$y);
</code>
</pre>
Here's what is prints:
`12345678901.234568:234567642.211914`
I was expecting:
`12345678901.234567:234567000`
This appears to be some sort of rounding issue in Perl. How would I get the `234567000`? Did I do something wrong? | perl | rounding | null | null | null | null | open | How to eliminate Perl rounding errors
===
Consider the following program:
<pre>
<code>
$x=12345678901.234567000;
$y=($x-int($x))*1000000000;
printf("%f:%f\n",$x,$y);
</code>
</pre>
Here's what is prints:
`12345678901.234568:234567642.211914`
I was expecting:
`12345678901.234567:234567000`
This appears to be some sort of rounding issue in Perl. How would I get the `234567000`? Did I do something wrong? | 0 |
4,064,160 | 10/31/2010 17:23:43 | 310,291 | 03/02/2010 15:22:39 | 1,257 | 16 | How to customize twitter "via" message in PHP ? | I can't find any mention on how to do this with twitter api. I'd like to do it without buying this commercial software:
http://www.webdesigndev.com/photoshop/how-to-brand-your-tweets-with-your-url-and-why-you-should | php | twitter | null | null | null | null | open | How to customize twitter "via" message in PHP ?
===
I can't find any mention on how to do this with twitter api. I'd like to do it without buying this commercial software:
http://www.webdesigndev.com/photoshop/how-to-brand-your-tweets-with-your-url-and-why-you-should | 0 |
9,098,655 | 02/01/2012 15:39:22 | 876,581 | 08/03/2011 12:22:37 | 149 | 1 | How can I add comments in SQL? | I want to add comment in a sql code. How can I do it ?
----- I use MySQL ------ | mysql | database | null | null | null | 02/02/2012 08:24:00 | too localized | How can I add comments in SQL?
===
I want to add comment in a sql code. How can I do it ?
----- I use MySQL ------ | 3 |
11,248,893 | 06/28/2012 16:22:58 | 768,505 | 05/24/2011 20:42:38 | 6 | 0 | PHP changing content in header | I have a site where the pages have the following structure:
<?php
include('header.php');
?>
Content goes here
<?php
include('header.php');
?>
In the header I have a div that contains anything that is wider than the page itself. This div is above the main content:
<? if ($slider == true){ ?>
<div id="slider">
Content wider than page goes here
</div>
<? } ?>
If I set $slider to true on any page, the above div will show. Now, I want to be able to edit the content of this div from any page. How do I do this? Simply adding a variable like $slider_content and then including it in the header did not work. | php | html | null | null | null | null | open | PHP changing content in header
===
I have a site where the pages have the following structure:
<?php
include('header.php');
?>
Content goes here
<?php
include('header.php');
?>
In the header I have a div that contains anything that is wider than the page itself. This div is above the main content:
<? if ($slider == true){ ?>
<div id="slider">
Content wider than page goes here
</div>
<? } ?>
If I set $slider to true on any page, the above div will show. Now, I want to be able to edit the content of this div from any page. How do I do this? Simply adding a variable like $slider_content and then including it in the header did not work. | 0 |
6,656,666 | 07/11/2011 21:15:23 | 673,726 | 03/23/2011 19:18:20 | 587 | 51 | Java socket timeout during read | What happens if a client connected through a `Socket` has a bad lag ?
Let's say i call `socket.read()` from the TCP server, and the client writes some stuff on the network pipe, but his connection is laging for 1 or 2 minutes. What will happen ? Will the `read` fail ? Or will it wait ?
I'm not sure if it's even possible, but i'm playing online chess on FICS server and sometimes it seems to happen from my point of view (I'm only a user of this chess server).
I'm asking this because i'm working on an online game and i'd like to handle such cases one way or another. But first I need to know if:
- it can happen
- it can be detected
Thanks | java | sockets | tcp | timeout | null | null | open | Java socket timeout during read
===
What happens if a client connected through a `Socket` has a bad lag ?
Let's say i call `socket.read()` from the TCP server, and the client writes some stuff on the network pipe, but his connection is laging for 1 or 2 minutes. What will happen ? Will the `read` fail ? Or will it wait ?
I'm not sure if it's even possible, but i'm playing online chess on FICS server and sometimes it seems to happen from my point of view (I'm only a user of this chess server).
I'm asking this because i'm working on an online game and i'd like to handle such cases one way or another. But first I need to know if:
- it can happen
- it can be detected
Thanks | 0 |
7,463,799 | 09/18/2011 19:17:02 | 788,856 | 06/08/2011 08:52:15 | 6 | 0 | Windows service with sql | partial class TestService : ServiceBase
{
FileStream fs;
StreamWriter sw;
//SqlConnection con;
//SqlCommand com;
public TestService()
{
InitializeComponent();
fs = new FileStream(@"C:\SampleLast.txt", FileMode.Create);
sw = new StreamWriter(fs);
//con = new SqlConnection(@"Data Source=.;Initial Catalog=MailDB;Integrated Security=True");
//com = new SqlCommand("select stock,product from Source", con);
//sw.WriteLine(con.ConnectionString);
//sw.WriteLine(com.CommandText);
}
protected override void OnStart(string[] args)
{
// TODO: Add code here to start your service.
try
{
if (!File.Exists(@"C:\SampleLast.txt"))
{
fs = new FileStream(@"C:\SampleLast.txt", FileMode.Create);
sw = new StreamWriter(fs);
}
sw.WriteLine("Service start {0}", DateTime.Now.ToString());
Timer timerNew = new Timer();
timerNew.Elapsed += new ElapsedEventHandler(timerNew_Elapsed);
timerNew.Enabled = true;
timerNew.Interval = 4000;
timerNew.Start();
sw.WriteLine(timerNew.Enabled.ToString());
sw.Flush();
}
catch(Exception Ex)
{
sw.WriteLine(Ex.ToString());
sw.Flush();
}
}
void timerNew_Elapsed(object sender, ElapsedEventArgs e)
{
sw.WriteLine("timer is working...{0}", DateTime.Now.ToString());
SqlConnection conn;
SqlCommand comm;
conn = new SqlConnection(@"Data Source=.;Initial Catalog=MailDB;Integrated Security=True");
comm = new SqlCommand("select Text,product from Source", conn);
SqlDataReader rd = comm.ExecuteReader();
while (rd.Read())
{
if (Convert.ToInt32(rd["Text"]) < 20)
{
sw.WriteLine("{0} stock state {1}", rd["product"].ToString(), rd["stock"].ToString());
}
}
sw.Flush();
}
protected override void OnStop()
{
// TODO: Add code here to perform any tear-down necessary to stop your service.
}
}
I want to use windows service for myproject.When i use those codes i havent any problem
Problem is when i add some sql codes in timer blocks.I have some effect in SampleLast.text file.Just running codes where OnStart() methods.I cant understand what is problem | c# | .net | service | windows-services | timer | 09/18/2011 19:55:57 | not a real question | Windows service with sql
===
partial class TestService : ServiceBase
{
FileStream fs;
StreamWriter sw;
//SqlConnection con;
//SqlCommand com;
public TestService()
{
InitializeComponent();
fs = new FileStream(@"C:\SampleLast.txt", FileMode.Create);
sw = new StreamWriter(fs);
//con = new SqlConnection(@"Data Source=.;Initial Catalog=MailDB;Integrated Security=True");
//com = new SqlCommand("select stock,product from Source", con);
//sw.WriteLine(con.ConnectionString);
//sw.WriteLine(com.CommandText);
}
protected override void OnStart(string[] args)
{
// TODO: Add code here to start your service.
try
{
if (!File.Exists(@"C:\SampleLast.txt"))
{
fs = new FileStream(@"C:\SampleLast.txt", FileMode.Create);
sw = new StreamWriter(fs);
}
sw.WriteLine("Service start {0}", DateTime.Now.ToString());
Timer timerNew = new Timer();
timerNew.Elapsed += new ElapsedEventHandler(timerNew_Elapsed);
timerNew.Enabled = true;
timerNew.Interval = 4000;
timerNew.Start();
sw.WriteLine(timerNew.Enabled.ToString());
sw.Flush();
}
catch(Exception Ex)
{
sw.WriteLine(Ex.ToString());
sw.Flush();
}
}
void timerNew_Elapsed(object sender, ElapsedEventArgs e)
{
sw.WriteLine("timer is working...{0}", DateTime.Now.ToString());
SqlConnection conn;
SqlCommand comm;
conn = new SqlConnection(@"Data Source=.;Initial Catalog=MailDB;Integrated Security=True");
comm = new SqlCommand("select Text,product from Source", conn);
SqlDataReader rd = comm.ExecuteReader();
while (rd.Read())
{
if (Convert.ToInt32(rd["Text"]) < 20)
{
sw.WriteLine("{0} stock state {1}", rd["product"].ToString(), rd["stock"].ToString());
}
}
sw.Flush();
}
protected override void OnStop()
{
// TODO: Add code here to perform any tear-down necessary to stop your service.
}
}
I want to use windows service for myproject.When i use those codes i havent any problem
Problem is when i add some sql codes in timer blocks.I have some effect in SampleLast.text file.Just running codes where OnStart() methods.I cant understand what is problem | 1 |
5,434,809 | 03/25/2011 15:47:47 | 172,396 | 06/24/2009 10:46:36 | 69 | 3 | Sql Server - OUTER APPLY versus Sub-qeries | Please consider the following 2 statements in Sql Server:
This one is using Nested sub-queries:
WITH cte AS
(
SELECT TOP 100 PERCENT *
FROM Segments
ORDER BY InvoiceDetailID, SegmentID
)
SELECT *, ReturnDate =
(SELECT TOP 1 cte.DepartureInfo
FROM cte
WHERE seg.InvoiceDetailID = cte.InvoiceDetailID
AND cte.SegmentID > seg.SegmentID),
DepartureCityCode =
(SELECT TOP 1 cte.DepartureCityCode
FROM cte
WHERE seg.InvoiceDetailID = cte.InvoiceDetailID
AND cte.SegmentID > seg.SegmentID)
FROM Segments seg
And this uses an OUTER APPLY operator:
WITH cte AS
(
SELECT TOP 100 PERCENT *
FROM Segments
ORDER BY InvoiceDetailID, SegmentID
)
SELECT seg.*, t.DepartureInfo AS ReturnDate, t.DepartureCityCode
FROM Segments seg OUTER APPLY (
SELECT TOP 1 cte.DepartureInfo, cte.DepartureCityCode
FROM cte
WHERE seg.InvoiceDetailID = cte.InvoiceDetailID
AND cte.SegmentID > seg.SegmentID
) t
Which of these 2 would potentially perform better considering that both Segments table can potentially have millions of rows?
My intuition is OUTER APPLY would perform better.
A couple of more questions:
1. Almost I am quite sure about this, but still wanted to confirm that in the first solution, the CTE would effectively be executed twice (because its referenced twice and CTE is expanded inline like a Macro).
2. Would CTE be executed once for each row when used in the OUTER APPLY operator? Also would it be executed for each row when used in nested query in first statement?? | sql | sql-server | common-table-expression | null | null | 05/08/2012 20:19:57 | not constructive | Sql Server - OUTER APPLY versus Sub-qeries
===
Please consider the following 2 statements in Sql Server:
This one is using Nested sub-queries:
WITH cte AS
(
SELECT TOP 100 PERCENT *
FROM Segments
ORDER BY InvoiceDetailID, SegmentID
)
SELECT *, ReturnDate =
(SELECT TOP 1 cte.DepartureInfo
FROM cte
WHERE seg.InvoiceDetailID = cte.InvoiceDetailID
AND cte.SegmentID > seg.SegmentID),
DepartureCityCode =
(SELECT TOP 1 cte.DepartureCityCode
FROM cte
WHERE seg.InvoiceDetailID = cte.InvoiceDetailID
AND cte.SegmentID > seg.SegmentID)
FROM Segments seg
And this uses an OUTER APPLY operator:
WITH cte AS
(
SELECT TOP 100 PERCENT *
FROM Segments
ORDER BY InvoiceDetailID, SegmentID
)
SELECT seg.*, t.DepartureInfo AS ReturnDate, t.DepartureCityCode
FROM Segments seg OUTER APPLY (
SELECT TOP 1 cte.DepartureInfo, cte.DepartureCityCode
FROM cte
WHERE seg.InvoiceDetailID = cte.InvoiceDetailID
AND cte.SegmentID > seg.SegmentID
) t
Which of these 2 would potentially perform better considering that both Segments table can potentially have millions of rows?
My intuition is OUTER APPLY would perform better.
A couple of more questions:
1. Almost I am quite sure about this, but still wanted to confirm that in the first solution, the CTE would effectively be executed twice (because its referenced twice and CTE is expanded inline like a Macro).
2. Would CTE be executed once for each row when used in the OUTER APPLY operator? Also would it be executed for each row when used in nested query in first statement?? | 4 |
10,069,995 | 04/09/2012 06:59:31 | 1,023,135 | 11/01/2011 05:38:01 | 1 | 0 | How to get current date in C#? | I'm using visual studio 2010 do developt my Windows phone application!
I'm newbie and i don't know how to show current date in follow format
For ex
I use
> String.Format("{0:dd/MM/yyyy}",date);
Out put:
> 09/04/2012 (this date is my datetime format)
But, I want out put exactly is (date only without "0"):
> 9
Sorry about my English, i'm a vietnamese | c# | datetime | format | null | null | null | open | How to get current date in C#?
===
I'm using visual studio 2010 do developt my Windows phone application!
I'm newbie and i don't know how to show current date in follow format
For ex
I use
> String.Format("{0:dd/MM/yyyy}",date);
Out put:
> 09/04/2012 (this date is my datetime format)
But, I want out put exactly is (date only without "0"):
> 9
Sorry about my English, i'm a vietnamese | 0 |
9,027,932 | 01/27/2012 01:32:35 | 1,122,441 | 12/30/2011 06:15:03 | 18 | 4 | how to let apache server do some preprocess to .js before it send the file | I was trying to compile JavaScript ,for the deploy code it is simple,just compile the code of the .js file,but for the develop code,compile means i must compile the .js file every time when I change it,which is not my favorite.
When developing,I use apache server to keep the code,I wish apache check every file and do compile if necessary before send it.
I have little experiences with apache server,anyone can help | javascript | apache | null | null | null | 01/29/2012 06:04:38 | not a real question | how to let apache server do some preprocess to .js before it send the file
===
I was trying to compile JavaScript ,for the deploy code it is simple,just compile the code of the .js file,but for the develop code,compile means i must compile the .js file every time when I change it,which is not my favorite.
When developing,I use apache server to keep the code,I wish apache check every file and do compile if necessary before send it.
I have little experiences with apache server,anyone can help | 1 |
1,179,697 | 07/24/2009 19:30:48 | 118,195 | 06/05/2009 18:16:50 | 10 | 1 | C# books or web sites for C++ developers | I am looking for web sites or books that would help a C++ developer to pick up C#.
So far, [this][1] is the best one I've found.
[1]: http://andymcm.com/csharpfaq.htm | c# | c++ | null | null | null | 09/30/2011 00:45:37 | not constructive | C# books or web sites for C++ developers
===
I am looking for web sites or books that would help a C++ developer to pick up C#.
So far, [this][1] is the best one I've found.
[1]: http://andymcm.com/csharpfaq.htm | 4 |
7,801,833 | 10/18/2011 02:36:58 | 345,599 | 05/19/2010 23:23:52 | 11 | 1 | Why am I seeing "Go to Facebook.com" on my canvas page? | I keep seeing the facebook logo with a link that reads "Go to Facebook.com" in my canvas app while screens are loading. Eventually the app loads fine, but what is this and how can I avoid it?
![Screenshot][1]
[1]: http://i.stack.imgur.com/67U0w.png | facebook | redirect | null | null | null | null | open | Why am I seeing "Go to Facebook.com" on my canvas page?
===
I keep seeing the facebook logo with a link that reads "Go to Facebook.com" in my canvas app while screens are loading. Eventually the app loads fine, but what is this and how can I avoid it?
![Screenshot][1]
[1]: http://i.stack.imgur.com/67U0w.png | 0 |
10,856,195 | 06/01/2012 19:23:31 | 1,431,448 | 06/01/2012 19:13:24 | 1 | 0 | C loop in a muli-variable array not working | The multi-array gets filled in properly, I have checked this with the debugger, however this loop here doesn't print out the second row of the array [1][0] to the first 0
void display(int pCount, int hands[4][26])
{
int j = 1;
int i;
while(j <= pCount)
{
printf("\nPlayer%i's hand: ",j);
i=0;
while(hands[j][i] != 0 && i < 26)
{
printf("%i ", hands[j][i]);
i++;
}
j++;
}
} | c | null | null | null | null | 06/01/2012 21:55:46 | too localized | C loop in a muli-variable array not working
===
The multi-array gets filled in properly, I have checked this with the debugger, however this loop here doesn't print out the second row of the array [1][0] to the first 0
void display(int pCount, int hands[4][26])
{
int j = 1;
int i;
while(j <= pCount)
{
printf("\nPlayer%i's hand: ",j);
i=0;
while(hands[j][i] != 0 && i < 26)
{
printf("%i ", hands[j][i]);
i++;
}
j++;
}
} | 3 |
4,830,466 | 01/28/2011 16:14:02 | 240,350 | 12/29/2009 17:43:16 | 102 | 2 | Regular Expression to get full string if it doesn't contain a specific character? | I need help with a regular expression that will find matches in the strings below:
> myDOG_test
>
> myCAT_test
Basically, I want to return 'DOG' or 'CAT' from these paths.
Then I have similar strings (all start with 'my') that don't contain the underscore AFTER the value I want, and in that case I just want to return the FULL string -- in a match group.
> myCentralReports
>
> myDEMO3
This is the REGEXP that I have so far:
.*?my(.*?)\_.*
This correctly puts CAT & DOG in the matching group, but I'm having problems matching the other 2 strings. Obviously I left the hardcoded underscore in there just to show you what I started with -- but I need to modify this for the other case. Any help is appreciated! Thanks. | php | regex | preg-match | null | null | null | open | Regular Expression to get full string if it doesn't contain a specific character?
===
I need help with a regular expression that will find matches in the strings below:
> myDOG_test
>
> myCAT_test
Basically, I want to return 'DOG' or 'CAT' from these paths.
Then I have similar strings (all start with 'my') that don't contain the underscore AFTER the value I want, and in that case I just want to return the FULL string -- in a match group.
> myCentralReports
>
> myDEMO3
This is the REGEXP that I have so far:
.*?my(.*?)\_.*
This correctly puts CAT & DOG in the matching group, but I'm having problems matching the other 2 strings. Obviously I left the hardcoded underscore in there just to show you what I started with -- but I need to modify this for the other case. Any help is appreciated! Thanks. | 0 |
10,723,972 | 05/23/2012 16:17:10 | 1,200,814 | 02/09/2012 22:24:07 | 5 | 0 | Calling jQuery & CSS in functions using php | I am having a problem in my script...i have this jQuery script & CSS that i call in my functions when needed...
<script type="text/javascript">
$(function(){
// Accordion
$("#accordion").accordion({ header: "h3" });
// Tabs
$('#tabs').tabs();
// Dialog
$('#dialog').dialog({
autoOpen: false,
width: 600,
buttons: {
"Ok": function() {
$(this).dialog("close");
},
"Cancel": function() {
$(this).dialog("close");
}
}
});
// Dialog Link
$('#dialog_link').click(function(){
$('#dialog').dialog('open');
return false;
});
// Datepicker
$('#datepicker').datepicker({
inline: true
});
// Slider
$('#slider').slider({
range: true,
values: [17, 67]
});
// Progressbar
$("#progressbar").progressbar({
value: 20
});
//hover states on the static widgets
$('#dialog_link, ul#icons li').hover(
function() { $(this).addClass('ui-state-hover'); },
function() { $(this).removeClass('ui-state-hover'); }
);
});
</script>
<style type="text/css">
/*demo page css*/
body{ font: 62.5% "Trebuchet MS", sans-serif; margin: 50px;}
.demoHeaders { margin-top: 2em; }
#dialog_link {padding: .4em 1em .4em 20px;text-decoration: none;position: relative;}
#dialog_link span.ui-icon {margin: 0 5px 0 0;position: absolute;left: .2em;top: 50%;margin-top: -8px;}
ul#icons {margin: 0; padding: 0;}
ul#icons li {margin: 2px; position: relative; padding: 4px 0; cursor: pointer; float: left; list-style: none;}
ul#icons span.ui-icon {float: left; margin: 0 4px;}
</style>
The problem i am facing is...when i call the function using this script....
echo ' <div id="accordion">
<div>
<h3><a href="#">Table 1</a></h3>
<div><table xmlns="http://www.w3.org/1999/xhtml" id="table-2">
<thead>
<tr>
<th>URL</th>
<th>Status</th>
</tr>
</thead>
<tbody><tr>
<td>.$url.</td>
<td>Working</td>
</tr></tbody>
</table></div></div></div> ';
When i called this script in 1 function it executed perfectly, but when i called it in 2 different functions at the same time i got distorted code, the css and jQuery function worked perfect for the first function that i called it in but the css and jQuery function got distorted in the 2nd function that i called it in...i have spent my entire day to figure out what the problem is but i couldn't find anything...any help will be appreciated :)
| php | jquery | css | function | null | 07/24/2012 02:54:00 | too localized | Calling jQuery & CSS in functions using php
===
I am having a problem in my script...i have this jQuery script & CSS that i call in my functions when needed...
<script type="text/javascript">
$(function(){
// Accordion
$("#accordion").accordion({ header: "h3" });
// Tabs
$('#tabs').tabs();
// Dialog
$('#dialog').dialog({
autoOpen: false,
width: 600,
buttons: {
"Ok": function() {
$(this).dialog("close");
},
"Cancel": function() {
$(this).dialog("close");
}
}
});
// Dialog Link
$('#dialog_link').click(function(){
$('#dialog').dialog('open');
return false;
});
// Datepicker
$('#datepicker').datepicker({
inline: true
});
// Slider
$('#slider').slider({
range: true,
values: [17, 67]
});
// Progressbar
$("#progressbar").progressbar({
value: 20
});
//hover states on the static widgets
$('#dialog_link, ul#icons li').hover(
function() { $(this).addClass('ui-state-hover'); },
function() { $(this).removeClass('ui-state-hover'); }
);
});
</script>
<style type="text/css">
/*demo page css*/
body{ font: 62.5% "Trebuchet MS", sans-serif; margin: 50px;}
.demoHeaders { margin-top: 2em; }
#dialog_link {padding: .4em 1em .4em 20px;text-decoration: none;position: relative;}
#dialog_link span.ui-icon {margin: 0 5px 0 0;position: absolute;left: .2em;top: 50%;margin-top: -8px;}
ul#icons {margin: 0; padding: 0;}
ul#icons li {margin: 2px; position: relative; padding: 4px 0; cursor: pointer; float: left; list-style: none;}
ul#icons span.ui-icon {float: left; margin: 0 4px;}
</style>
The problem i am facing is...when i call the function using this script....
echo ' <div id="accordion">
<div>
<h3><a href="#">Table 1</a></h3>
<div><table xmlns="http://www.w3.org/1999/xhtml" id="table-2">
<thead>
<tr>
<th>URL</th>
<th>Status</th>
</tr>
</thead>
<tbody><tr>
<td>.$url.</td>
<td>Working</td>
</tr></tbody>
</table></div></div></div> ';
When i called this script in 1 function it executed perfectly, but when i called it in 2 different functions at the same time i got distorted code, the css and jQuery function worked perfect for the first function that i called it in but the css and jQuery function got distorted in the 2nd function that i called it in...i have spent my entire day to figure out what the problem is but i couldn't find anything...any help will be appreciated :)
| 3 |
3,366,108 | 07/29/2010 19:11:16 | 349,223 | 05/24/2010 18:49:03 | 16 | 1 | Flash disable a button/movie clip, not working? | I am using Greensock to tween and during a rollOver I need to disable some buttons. I am pretty sure the code is right but the buttons do NOT disable?
code:
import com.greensock.*;
btn_skins.addEventListener(MouseEvent.CLICK,
function() {
TweenLite.to(mtvOrange, .25, {y:0});
}
);
btn_teenwolf.addEventListener(MouseEvent.CLICK,
function() {
TweenLite.to(mtvOrange, .25, {y:154.35});
}
);
mtvOrange.addEventListener(MouseEvent.ROLL_OVER,
function() {
TweenLite.to(mtvRed, .25, {y:30});
btn_skins.mouseEnabled = false;
btn_teenwolf.enabled = false;
btn_skins.enabled = false;
trace("hi there people");
}
);
Any ideas?
| flash | actionscript | button | disable | null | null | open | Flash disable a button/movie clip, not working?
===
I am using Greensock to tween and during a rollOver I need to disable some buttons. I am pretty sure the code is right but the buttons do NOT disable?
code:
import com.greensock.*;
btn_skins.addEventListener(MouseEvent.CLICK,
function() {
TweenLite.to(mtvOrange, .25, {y:0});
}
);
btn_teenwolf.addEventListener(MouseEvent.CLICK,
function() {
TweenLite.to(mtvOrange, .25, {y:154.35});
}
);
mtvOrange.addEventListener(MouseEvent.ROLL_OVER,
function() {
TweenLite.to(mtvRed, .25, {y:30});
btn_skins.mouseEnabled = false;
btn_teenwolf.enabled = false;
btn_skins.enabled = false;
trace("hi there people");
}
);
Any ideas?
| 0 |
5,724,969 | 04/20/2011 02:42:20 | 714,607 | 04/19/2011 05:48:06 | 1 | 0 | Selecting a datagridview | My Questions is what if you select a datagridview and it will the value on the textboxes..
here's my code:
txtUsername.Text = grdUser.SelectedRow.Cells(1).Text;
thanks! | c# | null | null | null | null | 04/22/2011 01:55:57 | not a real question | Selecting a datagridview
===
My Questions is what if you select a datagridview and it will the value on the textboxes..
here's my code:
txtUsername.Text = grdUser.SelectedRow.Cells(1).Text;
thanks! | 1 |
6,169,394 | 05/29/2011 17:54:06 | 290,744 | 03/10/2010 17:13:36 | 66 | 3 | What is the purpose of using UIViewController IBOutlet | I am in the learning phase of iOS programming. I am trying to add a NIB (called B) in another NIB (called A). To do so, I have added a View Controller in A which uses the B NIB (using NIB Name). In addition, in the A's ViewController, I have created an IBOutlet to store B's ViewController. Finally, in A I have connected the IBOutlet to the ViewController referring to B.
Now, I expect that when I run the project, I would see that B is loaded whenever A is loaded, but that is not the case. To achieve this, I have to initialize B pragmatically using initWithNibName in A's viewDidLoad method, and set it to the IBOutlet. But this part is something that is not dependent of using both IBOutlet in A and adding a ViewController to A that refers to B. In other words, if I had simply initialized B in A's viewDidLoad without creating an IBOutlet in A and without creating a View Controller object in A, that would have worked just as well.
So my question is, what is the purpose of using IBOutlet for adding custom View Controller NIBs?
| iphone | interface-builder | iboutlet | null | null | null | open | What is the purpose of using UIViewController IBOutlet
===
I am in the learning phase of iOS programming. I am trying to add a NIB (called B) in another NIB (called A). To do so, I have added a View Controller in A which uses the B NIB (using NIB Name). In addition, in the A's ViewController, I have created an IBOutlet to store B's ViewController. Finally, in A I have connected the IBOutlet to the ViewController referring to B.
Now, I expect that when I run the project, I would see that B is loaded whenever A is loaded, but that is not the case. To achieve this, I have to initialize B pragmatically using initWithNibName in A's viewDidLoad method, and set it to the IBOutlet. But this part is something that is not dependent of using both IBOutlet in A and adding a ViewController to A that refers to B. In other words, if I had simply initialized B in A's viewDidLoad without creating an IBOutlet in A and without creating a View Controller object in A, that would have worked just as well.
So my question is, what is the purpose of using IBOutlet for adding custom View Controller NIBs?
| 0 |
9,050,136 | 01/29/2012 01:19:05 | 959,214 | 09/22/2011 13:30:37 | 1 | 0 | Simple product image in Config product - Magento 1.5 | I am using Magento 1.5 and have around 33,450 products on my site. 32000 are simple products attached to 1300 configurable products.
Now, the main problem is that I need to change the product image when my customer selects different color.
How can I do that?
I already installed http://www.magentocommerce.com/magento-connect/simple-configurable-products.html and this displays the prices of the simple products which is awesome. But I need it to display pictures of simple products as well.
Any idea how to do this? | magento | null | null | null | null | null | open | Simple product image in Config product - Magento 1.5
===
I am using Magento 1.5 and have around 33,450 products on my site. 32000 are simple products attached to 1300 configurable products.
Now, the main problem is that I need to change the product image when my customer selects different color.
How can I do that?
I already installed http://www.magentocommerce.com/magento-connect/simple-configurable-products.html and this displays the prices of the simple products which is awesome. But I need it to display pictures of simple products as well.
Any idea how to do this? | 0 |
9,329,085 | 02/17/2012 13:26:58 | 390,973 | 07/13/2010 21:19:08 | 48 | 3 | Store JSON Blobs in MySQL or S3 | I'm going to be storing some specification data as JSON strings (height, weight etc) -- one per product. The data will be accessed very infrequently (once initially and then only again if I change an algorithm and need to update the summary metrics). My plan is to store a reference to the JSON string's location in a MySQL database, along with the rest of the product data.
Each blob is around 6k and, assuming I'm going to store 10m of them, my tests indicate that the size of a MySQL table with these 10m rows would be ~70GB (including an id column with an index). Storing them in S3 would work out slightly cheaper but it's low in both cases.
Are there any disadvantage to putting them in MySQL. Would the one very large table have an impact on the performance of the rest of the server? | json | amazon-s3 | amazon-web-services | amazon-rds | null | null | open | Store JSON Blobs in MySQL or S3
===
I'm going to be storing some specification data as JSON strings (height, weight etc) -- one per product. The data will be accessed very infrequently (once initially and then only again if I change an algorithm and need to update the summary metrics). My plan is to store a reference to the JSON string's location in a MySQL database, along with the rest of the product data.
Each blob is around 6k and, assuming I'm going to store 10m of them, my tests indicate that the size of a MySQL table with these 10m rows would be ~70GB (including an id column with an index). Storing them in S3 would work out slightly cheaper but it's low in both cases.
Are there any disadvantage to putting them in MySQL. Would the one very large table have an impact on the performance of the rest of the server? | 0 |
2,697,390 | 04/23/2010 09:12:59 | 108,802 | 05/18/2009 13:37:08 | 301 | 10 | make inference rule for files in a folder | I use GNU make, I want my source files and object files to be in different folders.
As a first step, I want the source files at the root of my project folder, and the object files in a subfolder (say `Debug/`).
The inference rule would be:
.ss.obj:
echo Assembling $*.ss...
$(ASSEMBLY) $(2210_ASSEMBLY_FLAGS) $*.ss -o Debug\$*.obj
but in that case, make rebuilds all files all the time, since there are no .obj in the root folder.
Is there a way to include a folder for the target in the line `.ss.obj`?
I also tried:
$(OBJS_WITH_PATH):$(SRC)
echo Assembling $<...
$(ASSEMBLY) $(ASSEMBLY_FLAGS) $< -o $@
with `$(SRC)` as a list of all my sources, `$(OBJS_WITH_PATH)` built that way:
OBJS_WITH_PATH = $(patsubst %.ss,Debug\\%.obj,$(SRC))
but that builds a dependency on all source files for all object files.
What I would like is to modify the inference rule I wrote first, to take `Debug/*.obj` files. What it says now is `no rule to make target Debug/asdfasdf.obj`. | make | inference | null | null | null | null | open | make inference rule for files in a folder
===
I use GNU make, I want my source files and object files to be in different folders.
As a first step, I want the source files at the root of my project folder, and the object files in a subfolder (say `Debug/`).
The inference rule would be:
.ss.obj:
echo Assembling $*.ss...
$(ASSEMBLY) $(2210_ASSEMBLY_FLAGS) $*.ss -o Debug\$*.obj
but in that case, make rebuilds all files all the time, since there are no .obj in the root folder.
Is there a way to include a folder for the target in the line `.ss.obj`?
I also tried:
$(OBJS_WITH_PATH):$(SRC)
echo Assembling $<...
$(ASSEMBLY) $(ASSEMBLY_FLAGS) $< -o $@
with `$(SRC)` as a list of all my sources, `$(OBJS_WITH_PATH)` built that way:
OBJS_WITH_PATH = $(patsubst %.ss,Debug\\%.obj,$(SRC))
but that builds a dependency on all source files for all object files.
What I would like is to modify the inference rule I wrote first, to take `Debug/*.obj` files. What it says now is `no rule to make target Debug/asdfasdf.obj`. | 0 |
2,416,844 | 03/10/2010 12:35:52 | 249,991 | 01/13/2010 16:23:24 | 136 | 10 | how to set custom title bar TextView Value dynamically in android? | friends,
i have created custom title bar using following titlebar.xml file with code
<?xml version="1.0" encoding="utf-8"?>
<TextView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/myTitle"
android:text="This is my new title"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:textColor="@color/titletextcolor"
android:layout_marginLeft="25px"
android:paddingTop="3px"
/>
and java code to display custom title bar on each activity.
@Override
public void onCreate(Bundle savedInstanceState)
{
requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.mytitle);
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
now i want to set textview value dynamically in each activity can any one guide me how can i achieve this?
using findviewbyid here i dont get reference of that textview to set value because
main layout does not contains any textbox with such a name but mytitle.
any help would be appriciated. | android | layout | activity | null | null | null | open | how to set custom title bar TextView Value dynamically in android?
===
friends,
i have created custom title bar using following titlebar.xml file with code
<?xml version="1.0" encoding="utf-8"?>
<TextView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/myTitle"
android:text="This is my new title"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:textColor="@color/titletextcolor"
android:layout_marginLeft="25px"
android:paddingTop="3px"
/>
and java code to display custom title bar on each activity.
@Override
public void onCreate(Bundle savedInstanceState)
{
requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.mytitle);
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
now i want to set textview value dynamically in each activity can any one guide me how can i achieve this?
using findviewbyid here i dont get reference of that textview to set value because
main layout does not contains any textbox with such a name but mytitle.
any help would be appriciated. | 0 |
7,860,662 | 10/22/2011 15:46:51 | 931,872 | 09/07/2011 02:19:13 | 271 | 2 | MFC database program | I want to make simple database program by use Microsoft Visual Studio 2008.
I have previously never created database program.
My program must communicate with mdb file.
Also My project is based on Dialog mode.
I want to know how can I get data from mde file and write.
Where can I find some articles about this? Or Could you send me an simple project?
| database | mfc | dialog | access | null | null | open | MFC database program
===
I want to make simple database program by use Microsoft Visual Studio 2008.
I have previously never created database program.
My program must communicate with mdb file.
Also My project is based on Dialog mode.
I want to know how can I get data from mde file and write.
Where can I find some articles about this? Or Could you send me an simple project?
| 0 |
8,033,668 | 11/07/2011 07:14:16 | 616,342 | 02/14/2011 14:17:38 | 163 | 6 | how can we differentiate the image filter effects? | How can we differentiate the image filter effects? on what basis we can check the image filters like based on color matrix or pixels?Actually iam developing the image filter library in java so i want to know the difference between each image filters. ex vintage effect, Polaroid effect,sepia effect..etc.
Try to help me.
Thaks in advance | java | null | null | null | null | 11/07/2011 17:44:10 | not a real question | how can we differentiate the image filter effects?
===
How can we differentiate the image filter effects? on what basis we can check the image filters like based on color matrix or pixels?Actually iam developing the image filter library in java so i want to know the difference between each image filters. ex vintage effect, Polaroid effect,sepia effect..etc.
Try to help me.
Thaks in advance | 1 |
299,628 | 11/18/2008 18:14:26 | 598 | 08/07/2008 02:49:41 | 3,708 | 125 | Is an entity body allowed for an HTTP DELETE request? | When issuing an HTTP DELETE request, the request URI should completely identify the resource to delete. However, is it allowable to add extra meta-data as part of the entity body of the request? | http | rest | null | null | null | null | open | Is an entity body allowed for an HTTP DELETE request?
===
When issuing an HTTP DELETE request, the request URI should completely identify the resource to delete. However, is it allowable to add extra meta-data as part of the entity body of the request? | 0 |
11,617,859 | 07/23/2012 17:57:12 | 1,546,502 | 07/23/2012 17:21:21 | 1 | 0 | How to implement tag following in database? | I'm making a micro-blogging website where users can follow tags. Like in twitter, users can follow other users.. in my project they can follow tags as well. What should be the database design to implement tag following? User following is easy.
One way is to have like 5 tag ID columns in the table containing posts:
Table: Posts<br/>
Columns: PostID, AuthorID, TimeStamp, Content, Tag1,Tag2...Tag5
I will make two comma separated lists: One is for the users the given user is following and the other for the tags the given user is following: $UserFollowingList and $TagFollowingList
and the select query can be like:
select ... from \`Posts\` where ($Condition1) or ($Condition2) order by \`PostID\` desc ...
$Condition1 = "\`AuthorID\` in $UserFollowingList"<br/>
$Condition2 = " ( \`Tag1\` in $TagFollowingList ) or ( \`Tag2\` in $TagFollowingList ) ... or ( \`Tag5\` in $TagFollowingList )"
Please suggest a better way? And what if I don't want to limit to 5 tags? I've an idea but want to know what will experience developers like you will do?
| database | database-schema | null | null | null | null | open | How to implement tag following in database?
===
I'm making a micro-blogging website where users can follow tags. Like in twitter, users can follow other users.. in my project they can follow tags as well. What should be the database design to implement tag following? User following is easy.
One way is to have like 5 tag ID columns in the table containing posts:
Table: Posts<br/>
Columns: PostID, AuthorID, TimeStamp, Content, Tag1,Tag2...Tag5
I will make two comma separated lists: One is for the users the given user is following and the other for the tags the given user is following: $UserFollowingList and $TagFollowingList
and the select query can be like:
select ... from \`Posts\` where ($Condition1) or ($Condition2) order by \`PostID\` desc ...
$Condition1 = "\`AuthorID\` in $UserFollowingList"<br/>
$Condition2 = " ( \`Tag1\` in $TagFollowingList ) or ( \`Tag2\` in $TagFollowingList ) ... or ( \`Tag5\` in $TagFollowingList )"
Please suggest a better way? And what if I don't want to limit to 5 tags? I've an idea but want to know what will experience developers like you will do?
| 0 |
3,438,635 | 08/09/2010 09:09:20 | 414,893 | 08/09/2010 09:09:20 | 1 | 0 | Give the solution of twice outer join |
Select MaterialProcessSlip.*,Vendor.CompanyName,O.Name from MaterialProcessSlip ProcessSlip left
outer join Vendors Vendor on (ProcessSlip.SubContractorId=Vendor.Id) MaterialProcessSlip left outer join Operations O on (ProcessSlip.Operationsid=O.id)
| c# | null | null | null | null | 08/10/2010 15:24:36 | not a real question | Give the solution of twice outer join
===
Select MaterialProcessSlip.*,Vendor.CompanyName,O.Name from MaterialProcessSlip ProcessSlip left
outer join Vendors Vendor on (ProcessSlip.SubContractorId=Vendor.Id) MaterialProcessSlip left outer join Operations O on (ProcessSlip.Operationsid=O.id)
| 1 |
6,918,555 | 08/02/2011 21:00:30 | 789,188 | 06/07/2011 13:37:11 | 58 | 0 | ANTLR: how to parse a region within matching brackets with a lexer | i want to parse something like this in my lexer:
( begin expression )
where expression are also surrounded by brackets. it isn't important what is in the expression, i just want to have all what's between the (begin and the matching ) as a token. an example would be:
<pre><code>(begin
(define x (+ 1 2)))</code></pre>
so the text of the token should be <pre><code>(define x (+ 1 2)))</code></pre>
something like
PROGRAM : LPAREN BEGIN .* RPAREN;
does (obviously) not work because as soon as he sees a ")", he thinks the rule is over, but i need the matching bracket for this.
how can i do that? | antlr | matching | lexer | brackets | null | null | open | ANTLR: how to parse a region within matching brackets with a lexer
===
i want to parse something like this in my lexer:
( begin expression )
where expression are also surrounded by brackets. it isn't important what is in the expression, i just want to have all what's between the (begin and the matching ) as a token. an example would be:
<pre><code>(begin
(define x (+ 1 2)))</code></pre>
so the text of the token should be <pre><code>(define x (+ 1 2)))</code></pre>
something like
PROGRAM : LPAREN BEGIN .* RPAREN;
does (obviously) not work because as soon as he sees a ")", he thinks the rule is over, but i need the matching bracket for this.
how can i do that? | 0 |
11,004,292 | 06/12/2012 20:24:34 | 207,937 | 11/10/2009 16:23:57 | 74 | 4 | .htaccess rewrite wildcard subdomain w/ capistrano deployments | I'm struggling to get a .htaccess thats working for me in this situation;
I've a wildcard domain pointing to /staging on my server, the folder looks something like this;
/staging/**newproject**/
/staging/**newproject**/current/ **<-- this is a symlink to the latest release**
/staging/**newproject**/releases/
/staging/**newproject**/releases/20120612191029/ **<-- this is the latest release**
/staging/**anothernewproject**/
/staging/**anothernewproject**/current/ **<-- this is a symlink to the latest release**
.... and so on
Each of the project folder has its own .htaccess thing going on, it could be a magento, wordpress, cakephp etc installation which has been deployed by capistrano.
I want it so if i go to: http://newproject.staging.mydomain.com/ it is re-written to show the content in that folders "current" directory for example;
http://newproject.staging.mydomain.com/ would show /staging/newproject/current/ and
http://anothernewproject.staging.mydomain.com/products would show /staging/anothernewproject/current/
Here is what i have tried already;
RewriteEngine on
Options +FollowSymLinks
RewriteCond %{HTTP_HOST} ^([\w-]+)\.staging\.mydomain\.com$
RewriteRule ^(.*)$ %1/current/$1 [LAST,QSA]
Which kind of works but not as i would like, if i go to http://newproject.staging.mydomain.com/ i get redirected to http://newproject.staging.mydomain.com/newproject/current/
If i click to go through to a page i get http://newproject.staging.mydomain.com/newproject/current/index.php/about-magento-demo-store
whereas what i want ideally is just http://newproject.staging.mydomain.com/index.php/about-magento-demo-store
Not sure if it is relevant but i am on a Media Temple dedicated virtual 4.0 box.
Could any one offer any tips on how to solve this? thanks in advance!
| .htaccess | mod-rewrite | capistrano | mediatemple | null | 06/14/2012 12:01:54 | off topic | .htaccess rewrite wildcard subdomain w/ capistrano deployments
===
I'm struggling to get a .htaccess thats working for me in this situation;
I've a wildcard domain pointing to /staging on my server, the folder looks something like this;
/staging/**newproject**/
/staging/**newproject**/current/ **<-- this is a symlink to the latest release**
/staging/**newproject**/releases/
/staging/**newproject**/releases/20120612191029/ **<-- this is the latest release**
/staging/**anothernewproject**/
/staging/**anothernewproject**/current/ **<-- this is a symlink to the latest release**
.... and so on
Each of the project folder has its own .htaccess thing going on, it could be a magento, wordpress, cakephp etc installation which has been deployed by capistrano.
I want it so if i go to: http://newproject.staging.mydomain.com/ it is re-written to show the content in that folders "current" directory for example;
http://newproject.staging.mydomain.com/ would show /staging/newproject/current/ and
http://anothernewproject.staging.mydomain.com/products would show /staging/anothernewproject/current/
Here is what i have tried already;
RewriteEngine on
Options +FollowSymLinks
RewriteCond %{HTTP_HOST} ^([\w-]+)\.staging\.mydomain\.com$
RewriteRule ^(.*)$ %1/current/$1 [LAST,QSA]
Which kind of works but not as i would like, if i go to http://newproject.staging.mydomain.com/ i get redirected to http://newproject.staging.mydomain.com/newproject/current/
If i click to go through to a page i get http://newproject.staging.mydomain.com/newproject/current/index.php/about-magento-demo-store
whereas what i want ideally is just http://newproject.staging.mydomain.com/index.php/about-magento-demo-store
Not sure if it is relevant but i am on a Media Temple dedicated virtual 4.0 box.
Could any one offer any tips on how to solve this? thanks in advance!
| 2 |
1,592,257 | 10/20/2009 03:11:46 | 192,808 | 10/20/2009 03:11:46 | 1 | 0 | ObjectUtils.equal(x,y) null can work | ObjectUtils.equal(x,y)
x if is null
can work? | java | null | null | null | null | 01/19/2012 21:23:25 | not a real question | ObjectUtils.equal(x,y) null can work
===
ObjectUtils.equal(x,y)
x if is null
can work? | 1 |
2,216,324 | 02/07/2010 07:46:58 | 182,332 | 10/01/2009 07:59:18 | 35 | 14 | What is the best load testing tool? | What is the best load testing tool for asp.net applications? | load | testing | null | null | null | 04/16/2012 14:24:38 | not constructive | What is the best load testing tool?
===
What is the best load testing tool for asp.net applications? | 4 |
6,165,987 | 05/29/2011 04:39:52 | 733,287 | 05/01/2011 13:00:26 | 144 | 19 | remove default error message from a zend form image field | hi i am using a zend image element in my project , i have validated the field . if i choose other than an image and submit the form , a default error message is displayed , i tried to remove it and add a custom message by
$image->removeDecorator('Error');
$image->addErrorMessage('Invalid image');
but it is not working . the error message is
> File '.zfproject.xml' is no image,
> 'application/xml' detected
how can i add a custom error message and remove the default error meassage , please help ....
this is my code
$image = new Zend_Form_Element_File('image');
$image->setLabel('Image URL :');
$image->setDestination($imagePath);
$image->addValidator('IsImage', false);
//$image->removeDecorator('Error');
//$image->addErrorMessage('tester'); | zend-framework | zend-form | null | null | null | null | open | remove default error message from a zend form image field
===
hi i am using a zend image element in my project , i have validated the field . if i choose other than an image and submit the form , a default error message is displayed , i tried to remove it and add a custom message by
$image->removeDecorator('Error');
$image->addErrorMessage('Invalid image');
but it is not working . the error message is
> File '.zfproject.xml' is no image,
> 'application/xml' detected
how can i add a custom error message and remove the default error meassage , please help ....
this is my code
$image = new Zend_Form_Element_File('image');
$image->setLabel('Image URL :');
$image->setDestination($imagePath);
$image->addValidator('IsImage', false);
//$image->removeDecorator('Error');
//$image->addErrorMessage('tester'); | 0 |
9,104,056 | 02/01/2012 22:06:09 | 1,183,327 | 02/01/2012 17:29:18 | 1 | 0 | memory error (access violation) on method parameters | I've got weird problem. I'm trying to write simple game in C++, but I failed on objects and data types. There's a code:
<!-- language: lang-cpp -->
// C++
// Statki
#include <stdio.h>
#include <time.h>
#include <map>
#include <vector>
#include <string>
#include <list>
#define D true
using namespace std;
void _(char* message){printf("%s\n",message);};
struct relpoint { int x,y; };
struct point { int x,y; };
struct size { int w,h; };
map<const char*, vector<relpoint> > shipshape;
list<char*> shipTypes = {"XS", "S", "M", "L", "XL"};
string alpha="ABCDEFGHIJKLMNOPRSTUVWXYZ";
enum fieldtype { UNKNOWN=-1,EMPTY=0,SHIP=1,HIT=2,MISS=3,};
enum rotation { EAST=0, SOUTH=1, WEST=2, NORTH=3 };
class Ship
{
char* type;
};
class Sea
{
public:
void init(size mapsize) { init( mapsize, EMPTY ); };
void init(size mapsize, fieldtype fill)
{
if(D)printf("Generating sea\n");
vector<fieldtype> v;
seamap.reserve(mapsize.h);
v.reserve(mapsize.w);
for (int y=0; y<mapsize.h; y++)
{
v.clear();
for(int x=0; x<mapsize.w; x++)
{
v.push_back(fill);
}
seamap.push_back(v);
}
view();
};
bool place_ship(Ship ship);
void view()
{
for( vector< vector<fieldtype> >::const_iterator yy = seamap.begin(); yy != seamap.end(); ++yy )
{
for( vector<fieldtype>::const_iterator xx = (*yy).begin(); xx != (*yy).end(); ++xx )
{
if(D)printf("%d ", *xx);
}
if(D)printf("\n");
}
};
private:
vector< vector<fieldtype> > seamap;
};
class Game
{
public:
void initmap(size mapsize)
{
if(D) printf("\nInit %d×%d map\n", mapsize.w, mapsize.h);
(*enemymap).init(mapsize, UNKNOWN);
//(*selfmap).init(mapsize);
};
bool placeship(string type, point position, rotation rotate);
fieldtype shoot(point target);
void viewmap(){(*selfmap).view();};
bool eog();
Sea * enemymap;
Sea * selfmap;
};
class Bot
{
public:
void init(size mapsize)
{
if(D)_("Init Bot");
}
private:
Game * g;
};
class Player
{
public:
Player() { if(D){_("Player fake init");} };
void init(size mapsize)
{
(*g).initmap(mapsize);
};
void viewmap(){(*g).viewmap();};
private:
Game * g;
};
class Router
{
public:
void startgame();
void welcomescreen()
{
printf("\n\n\n\t\t\tShips minigame\n\t\t\t\tby Kris\n\n");
mainmenu();
};
void mainmenu()
{
printf("Menu (type letter):\n\tN: New game\n\tS: Settings\n\tQ: Quit game\n\n > ");
char opt;
opt = toupper(getchar());
size ms;
switch(opt)
{
case 'N':
ms = getmapsize();
(*P1).init(ms);
(*P2).init(ms);
break;
case 'S':
break;
case 'Q':
break;
default:
printf("Invalid option %c", opt);
mainmenu();
}
};
private:
Player * P1;
Bot * P2;
size getmapsize()
{
size ms;
printf("\nSet map size (X Y)\n > ");
scanf("%d %d", &ms.w, &ms.h);
return ms;
};
};
int main () {
vector<relpoint> shp;
shp.reserve(5);
list<char*>::const_iterator tp = shipTypes.begin();
shp.push_back({0,0});
shipshape[*(tp++)] = shp;
shp.push_back({1,0});
shipshape[*(tp++)] = shp;
shp.push_back({2,0});
shipshape[*(tp++)] = shp;
shp.push_back({3,0});
shipshape[*(tp++)] = shp;
shp.push_back({2,1});
shipshape[*tp] = shp;
Router R;
R.welcomescreen();
printf("\n\n");
return 0;
}
It can be compiled, but after line *Init 5×5 map* program stops with *Naruszenie ochrony pamięci* (*Memory access violation* in polish) error. Problem seems to occur at both `Sea::init()` functions.
I'm compiling it with `g++ -std=c++0x -Wno-write-strings ships2.cpp` (to prevent warnings) on Ubuntu.
Any idea what's wrong with it? | c++ | memory-allocation | segmentation-fault | null | null | null | open | memory error (access violation) on method parameters
===
I've got weird problem. I'm trying to write simple game in C++, but I failed on objects and data types. There's a code:
<!-- language: lang-cpp -->
// C++
// Statki
#include <stdio.h>
#include <time.h>
#include <map>
#include <vector>
#include <string>
#include <list>
#define D true
using namespace std;
void _(char* message){printf("%s\n",message);};
struct relpoint { int x,y; };
struct point { int x,y; };
struct size { int w,h; };
map<const char*, vector<relpoint> > shipshape;
list<char*> shipTypes = {"XS", "S", "M", "L", "XL"};
string alpha="ABCDEFGHIJKLMNOPRSTUVWXYZ";
enum fieldtype { UNKNOWN=-1,EMPTY=0,SHIP=1,HIT=2,MISS=3,};
enum rotation { EAST=0, SOUTH=1, WEST=2, NORTH=3 };
class Ship
{
char* type;
};
class Sea
{
public:
void init(size mapsize) { init( mapsize, EMPTY ); };
void init(size mapsize, fieldtype fill)
{
if(D)printf("Generating sea\n");
vector<fieldtype> v;
seamap.reserve(mapsize.h);
v.reserve(mapsize.w);
for (int y=0; y<mapsize.h; y++)
{
v.clear();
for(int x=0; x<mapsize.w; x++)
{
v.push_back(fill);
}
seamap.push_back(v);
}
view();
};
bool place_ship(Ship ship);
void view()
{
for( vector< vector<fieldtype> >::const_iterator yy = seamap.begin(); yy != seamap.end(); ++yy )
{
for( vector<fieldtype>::const_iterator xx = (*yy).begin(); xx != (*yy).end(); ++xx )
{
if(D)printf("%d ", *xx);
}
if(D)printf("\n");
}
};
private:
vector< vector<fieldtype> > seamap;
};
class Game
{
public:
void initmap(size mapsize)
{
if(D) printf("\nInit %d×%d map\n", mapsize.w, mapsize.h);
(*enemymap).init(mapsize, UNKNOWN);
//(*selfmap).init(mapsize);
};
bool placeship(string type, point position, rotation rotate);
fieldtype shoot(point target);
void viewmap(){(*selfmap).view();};
bool eog();
Sea * enemymap;
Sea * selfmap;
};
class Bot
{
public:
void init(size mapsize)
{
if(D)_("Init Bot");
}
private:
Game * g;
};
class Player
{
public:
Player() { if(D){_("Player fake init");} };
void init(size mapsize)
{
(*g).initmap(mapsize);
};
void viewmap(){(*g).viewmap();};
private:
Game * g;
};
class Router
{
public:
void startgame();
void welcomescreen()
{
printf("\n\n\n\t\t\tShips minigame\n\t\t\t\tby Kris\n\n");
mainmenu();
};
void mainmenu()
{
printf("Menu (type letter):\n\tN: New game\n\tS: Settings\n\tQ: Quit game\n\n > ");
char opt;
opt = toupper(getchar());
size ms;
switch(opt)
{
case 'N':
ms = getmapsize();
(*P1).init(ms);
(*P2).init(ms);
break;
case 'S':
break;
case 'Q':
break;
default:
printf("Invalid option %c", opt);
mainmenu();
}
};
private:
Player * P1;
Bot * P2;
size getmapsize()
{
size ms;
printf("\nSet map size (X Y)\n > ");
scanf("%d %d", &ms.w, &ms.h);
return ms;
};
};
int main () {
vector<relpoint> shp;
shp.reserve(5);
list<char*>::const_iterator tp = shipTypes.begin();
shp.push_back({0,0});
shipshape[*(tp++)] = shp;
shp.push_back({1,0});
shipshape[*(tp++)] = shp;
shp.push_back({2,0});
shipshape[*(tp++)] = shp;
shp.push_back({3,0});
shipshape[*(tp++)] = shp;
shp.push_back({2,1});
shipshape[*tp] = shp;
Router R;
R.welcomescreen();
printf("\n\n");
return 0;
}
It can be compiled, but after line *Init 5×5 map* program stops with *Naruszenie ochrony pamięci* (*Memory access violation* in polish) error. Problem seems to occur at both `Sea::init()` functions.
I'm compiling it with `g++ -std=c++0x -Wno-write-strings ships2.cpp` (to prevent warnings) on Ubuntu.
Any idea what's wrong with it? | 0 |
10,142,099 | 04/13/2012 13:50:06 | 1,331,542 | 04/13/2012 12:11:25 | 1 | 0 | Jquery Library - Drawing House | I need some kind of WEB plugin (Javascript probably) where I need to design the house (kitchen,bathroom) with the furniture too.
Somebody know anything like that??
Thank youu! | javascript | jquery | jquery-ui | design | svg | 04/13/2012 15:10:46 | not a real question | Jquery Library - Drawing House
===
I need some kind of WEB plugin (Javascript probably) where I need to design the house (kitchen,bathroom) with the furniture too.
Somebody know anything like that??
Thank youu! | 1 |
111,007 | 09/21/2008 13:19:50 | 11,612 | 09/16/2008 09:30:01 | 11 | 3 | flex webservice client | Has anybody any useful links that can be used to consume a web service using flex?
The easier the solution the better
Thanks
| flex | webservices | null | null | null | 07/12/2011 14:56:37 | not constructive | flex webservice client
===
Has anybody any useful links that can be used to consume a web service using flex?
The easier the solution the better
Thanks
| 4 |
4,837,861 | 01/29/2011 16:09:18 | 554,216 | 12/26/2010 09:22:38 | 5 | 0 | Delpi DLL comport | i am developing a DLL in Delphi 2010 that is communicating with Comport.
But there is a problem that ia dont get any value from the port.
i am using the RxChar but i think the com objet is not triggering the RxChar command.
how can i trigger the RxChar so it would work??
unit unitfxvogir;
{$WARN SYMBOL_PLATFORM OFF}
interface
uses
ComObj, ActiveX, AxCtrls, Classes,
ridFXVogir_TLB, StdVcl, CPort, CPortCtl, ExtCtrls;
type
Tfxvogir = class(TAutoObject, IConnectionPointContainer, Ifxvogir)
private
{ Private declarations }
FConnectionPoints: TConnectionPoints;
FConnectionPoint: TConnectionPoint;
FEvents: IfxvogirEvents;
{ note: FEvents maintains a *single* event sink. For access to more
than one event sink, use FConnectionPoint.SinkList, and iterate
through the list of sinks. }
ComPort1: TComPort;
public
procedure Initialize; override;
procedure AfterConstruction; override;
procedure BeforeDestruction; override;
procedure ComPort1RxChar(Sender: TObject; Count: Integer); safecall;
protected
function OpnaVog(const ComPort: WideString): WordBool; safecall;
function LokaVog: WordBool; safecall;
function Vigt: WideString; safecall;
{ Protected declarations }
function SendaSkipun(const Inntak: WideString): WordBool; safecall;
property ConnectionPoints: TConnectionPoints read FConnectionPoints
implements IConnectionPointContainer;
procedure EventSinkChanged(const EventSink: IUnknown); override;
end;
implementation
uses ComServ, unitAdgerdir;
procedure Tfxvogir.EventSinkChanged(const EventSink: IUnknown);
begin
FEvents := EventSink as IfxvogirEvents;
end;
procedure Tfxvogir.Initialize;
begin
inherited Initialize;
FConnectionPoints := TConnectionPoints.Create(Self);
if AutoFactory.EventTypeInfo <> nil then
FConnectionPoint := FConnectionPoints.CreateConnectionPoint(
AutoFactory.EventIID, ckSingle, EventConnect)
else FConnectionPoint := nil;
end;
procedure Tfxvogir.AfterConstruction;
begin
inherited;
ComPort1 := TComPort.Create(ComPort1);
//tmrtimer := TTimer.Create(ComPort1);
end;
procedure Tfxvogir.BeforeDestruction;
begin
inherited;
ComPort1.Free;
//tmrtimer.Free;
end;
function Tfxvogir.OpnaVog(const ComPort: WideString): WordBool;
begin
try
//tmrtimer.Enabled := false;
//tmrtimer.Interval := 100;
ComPort1.Port := ComPort;
ComPort1.BaudRate := br2400;
ComPort1.DataBits := dbSeven;
ComPort1.StopBits := sbOneStopBit;
ComPort1.Parity.Bits := prEven;
ComPort1.FlowControl.FlowControl := fcNone;
if not ComPort1.Connected then
ComPort1.Open;
if ComPort1.Connected then
Result := True;
except
Result := False;
end;
end;
function Tfxvogir.LokaVog: WordBool;
begin
try
if ComPort1.Connected then
ComPort1.Close;
Result := True;
except
Result := False;
end;
end;
function Tfxvogir.Vigt: WideString;
begin
Result := g_rVigtun.VigtunGr;
end;
procedure Tfxvogir.ComPort1RxChar(Sender: TObject; Count: Integer);
var
Str: string;
str1 : ansichar;
i : Integer;
cStafur : AnsiChar;
begin
ComPort1.Readstr(Str, Count);
try
for i := 1 to count do begin
cStafur := AnsiChar(str[i]);
LesaSvar(cStafur);
end;
except
g_rVigtun.SvarTexti := 'Villa í tengingu';
end;
end;
function Tfxvogir.SendaSkipun(const Inntak: WideString): WordBool;
var
//I : Integer;
BCC : Integer;
sCommand : AnsiString;
begin
//ATH höndla ef slökkt er á vog = ekkert svar berst
Result := False;
g_rVigtun := FrumstillaVigtun;
if Length(Inntak) < 1 then begin
g_rVigtun.SvarTexti := 'VILLA: Engin skipun til að senda.';
exit(false);
end;
//Er þetta lögleg skipun if (rSending.Kaupsamn <> '') and (rSending.Kaupsamn[1] in ['K', 'V']) then begin
if not (Inntak[1] in ['C','G','M','O','R','T','W','Z']) then begin
g_rVigtun.SvarTexti := 'VILLA: ['+Inntak+'] er óþekkt skipun.';
exit(false);
end;
g_rVigtun.Skipun := ansichar(Inntak[1]);
SamskiptiByrja;
g_StoduVel := svNyttSvar;
BCC := ReiknaBCC(Inntak);
//Skipun er alltaf á forminu
//<STX><[SKIPUN][aukatexti]><ETX><BCC>
sCommand := STX + Inntak + ETX + Chr(BCC);
//ATH ætti að hreinsa inntaks buffer hér ?
try
ComPort1.WriteStr(sCommand);
except
end;
Result := True;
end;
initialization
TAutoObjectFactory.Create(ComServer, Tfxvogir, Class_fxvogir,
ciMultiInstance, tmApartment);
end.
| dll | delphi-2010 | comports | null | null | null | open | Delpi DLL comport
===
i am developing a DLL in Delphi 2010 that is communicating with Comport.
But there is a problem that ia dont get any value from the port.
i am using the RxChar but i think the com objet is not triggering the RxChar command.
how can i trigger the RxChar so it would work??
unit unitfxvogir;
{$WARN SYMBOL_PLATFORM OFF}
interface
uses
ComObj, ActiveX, AxCtrls, Classes,
ridFXVogir_TLB, StdVcl, CPort, CPortCtl, ExtCtrls;
type
Tfxvogir = class(TAutoObject, IConnectionPointContainer, Ifxvogir)
private
{ Private declarations }
FConnectionPoints: TConnectionPoints;
FConnectionPoint: TConnectionPoint;
FEvents: IfxvogirEvents;
{ note: FEvents maintains a *single* event sink. For access to more
than one event sink, use FConnectionPoint.SinkList, and iterate
through the list of sinks. }
ComPort1: TComPort;
public
procedure Initialize; override;
procedure AfterConstruction; override;
procedure BeforeDestruction; override;
procedure ComPort1RxChar(Sender: TObject; Count: Integer); safecall;
protected
function OpnaVog(const ComPort: WideString): WordBool; safecall;
function LokaVog: WordBool; safecall;
function Vigt: WideString; safecall;
{ Protected declarations }
function SendaSkipun(const Inntak: WideString): WordBool; safecall;
property ConnectionPoints: TConnectionPoints read FConnectionPoints
implements IConnectionPointContainer;
procedure EventSinkChanged(const EventSink: IUnknown); override;
end;
implementation
uses ComServ, unitAdgerdir;
procedure Tfxvogir.EventSinkChanged(const EventSink: IUnknown);
begin
FEvents := EventSink as IfxvogirEvents;
end;
procedure Tfxvogir.Initialize;
begin
inherited Initialize;
FConnectionPoints := TConnectionPoints.Create(Self);
if AutoFactory.EventTypeInfo <> nil then
FConnectionPoint := FConnectionPoints.CreateConnectionPoint(
AutoFactory.EventIID, ckSingle, EventConnect)
else FConnectionPoint := nil;
end;
procedure Tfxvogir.AfterConstruction;
begin
inherited;
ComPort1 := TComPort.Create(ComPort1);
//tmrtimer := TTimer.Create(ComPort1);
end;
procedure Tfxvogir.BeforeDestruction;
begin
inherited;
ComPort1.Free;
//tmrtimer.Free;
end;
function Tfxvogir.OpnaVog(const ComPort: WideString): WordBool;
begin
try
//tmrtimer.Enabled := false;
//tmrtimer.Interval := 100;
ComPort1.Port := ComPort;
ComPort1.BaudRate := br2400;
ComPort1.DataBits := dbSeven;
ComPort1.StopBits := sbOneStopBit;
ComPort1.Parity.Bits := prEven;
ComPort1.FlowControl.FlowControl := fcNone;
if not ComPort1.Connected then
ComPort1.Open;
if ComPort1.Connected then
Result := True;
except
Result := False;
end;
end;
function Tfxvogir.LokaVog: WordBool;
begin
try
if ComPort1.Connected then
ComPort1.Close;
Result := True;
except
Result := False;
end;
end;
function Tfxvogir.Vigt: WideString;
begin
Result := g_rVigtun.VigtunGr;
end;
procedure Tfxvogir.ComPort1RxChar(Sender: TObject; Count: Integer);
var
Str: string;
str1 : ansichar;
i : Integer;
cStafur : AnsiChar;
begin
ComPort1.Readstr(Str, Count);
try
for i := 1 to count do begin
cStafur := AnsiChar(str[i]);
LesaSvar(cStafur);
end;
except
g_rVigtun.SvarTexti := 'Villa í tengingu';
end;
end;
function Tfxvogir.SendaSkipun(const Inntak: WideString): WordBool;
var
//I : Integer;
BCC : Integer;
sCommand : AnsiString;
begin
//ATH höndla ef slökkt er á vog = ekkert svar berst
Result := False;
g_rVigtun := FrumstillaVigtun;
if Length(Inntak) < 1 then begin
g_rVigtun.SvarTexti := 'VILLA: Engin skipun til að senda.';
exit(false);
end;
//Er þetta lögleg skipun if (rSending.Kaupsamn <> '') and (rSending.Kaupsamn[1] in ['K', 'V']) then begin
if not (Inntak[1] in ['C','G','M','O','R','T','W','Z']) then begin
g_rVigtun.SvarTexti := 'VILLA: ['+Inntak+'] er óþekkt skipun.';
exit(false);
end;
g_rVigtun.Skipun := ansichar(Inntak[1]);
SamskiptiByrja;
g_StoduVel := svNyttSvar;
BCC := ReiknaBCC(Inntak);
//Skipun er alltaf á forminu
//<STX><[SKIPUN][aukatexti]><ETX><BCC>
sCommand := STX + Inntak + ETX + Chr(BCC);
//ATH ætti að hreinsa inntaks buffer hér ?
try
ComPort1.WriteStr(sCommand);
except
end;
Result := True;
end;
initialization
TAutoObjectFactory.Create(ComServer, Tfxvogir, Class_fxvogir,
ciMultiInstance, tmApartment);
end.
| 0 |
10,271,680 | 04/22/2012 20:08:10 | 1,350,017 | 04/22/2012 19:52:06 | 1 | 0 | ASP.NET C#, SQL Rendering images, sql query etc | Im creating a military site for an organisation. A part of the site is going to be a news/blog-wall.
The news are going to consist of an simpel article and for that article a few picture depending on what the article-writer is choosing.
In my database i made up two tables, one for news and one for pictures. Connected these together, the picture table consist only the URL for the picture, not the whole picture.
Now for the problem:
If there is only ONE picture connected to article everything works fine but if i get several pictures i get several rows for each picture but same article.
This gives me the next problem, my ASP.NET ListView things its a new article and renders out one picture per article and the same article text >.<
Ive been asking my teacher in uni for help but they seem all busy with other lectures.
I also wonder how to render out multiple pictures in ListView, got to use some foreach in code-behinde to get more image tags i guess but how?
Ill post this picture of my SQL query if it helps, look at row 2 and 3.
(Can't post image cuz of less than 10 reps T_T)
Thanks all in advance and remember im a novice programmer, this is maybe very easy? Im really torn about this as it can't be that hard I'm tellin myself.
[1]: http://i.stack.imgur.com/K6tGV.png | c# | asp.net | sql | null | null | 04/23/2012 11:04:34 | not constructive | ASP.NET C#, SQL Rendering images, sql query etc
===
Im creating a military site for an organisation. A part of the site is going to be a news/blog-wall.
The news are going to consist of an simpel article and for that article a few picture depending on what the article-writer is choosing.
In my database i made up two tables, one for news and one for pictures. Connected these together, the picture table consist only the URL for the picture, not the whole picture.
Now for the problem:
If there is only ONE picture connected to article everything works fine but if i get several pictures i get several rows for each picture but same article.
This gives me the next problem, my ASP.NET ListView things its a new article and renders out one picture per article and the same article text >.<
Ive been asking my teacher in uni for help but they seem all busy with other lectures.
I also wonder how to render out multiple pictures in ListView, got to use some foreach in code-behinde to get more image tags i guess but how?
Ill post this picture of my SQL query if it helps, look at row 2 and 3.
(Can't post image cuz of less than 10 reps T_T)
Thanks all in advance and remember im a novice programmer, this is maybe very easy? Im really torn about this as it can't be that hard I'm tellin myself.
[1]: http://i.stack.imgur.com/K6tGV.png | 4 |
6,718,078 | 07/16/2011 14:42:59 | 732,372 | 04/30/2011 12:14:40 | 64 | 2 | is it okay to use GNU public license to create application to a company? | Am i allowed to use Extjs java script library vaersion which published under GNU public license to create a web application for a private company?
Regards
| javascript | open-source | extjs | licensing | gnu | 07/16/2011 15:11:43 | off topic | is it okay to use GNU public license to create application to a company?
===
Am i allowed to use Extjs java script library vaersion which published under GNU public license to create a web application for a private company?
Regards
| 2 |
1,950,121 | 12/23/2009 00:49:09 | 206,446 | 11/08/2009 22:19:26 | 192 | 4 | sort an array and assign new numerical keys? | i have an array like this (after i unset some elements):
$array[3] = 'apple';
$array[5] = 'pear';
$array[23] = 'banana';
which function do i use to sort them to:
$array[0] = 'apple';
$array[1] = 'pear';
$array[2] = 'banana';
i tried some of the sort functions but it didnt work.
| php | sorting | arrays | null | null | null | open | sort an array and assign new numerical keys?
===
i have an array like this (after i unset some elements):
$array[3] = 'apple';
$array[5] = 'pear';
$array[23] = 'banana';
which function do i use to sort them to:
$array[0] = 'apple';
$array[1] = 'pear';
$array[2] = 'banana';
i tried some of the sort functions but it didnt work.
| 0 |
9,412,618 | 02/23/2012 11:58:04 | 1,177,567 | 01/30/2012 07:32:56 | 1 | 0 | How to find the cpu utilization(%) of a java class | Need an agent/java program that queries JVM and find the cpu utilization(%) of a java class and methods running in it .
| java | null | null | null | null | 06/06/2012 23:37:30 | not a real question | How to find the cpu utilization(%) of a java class
===
Need an agent/java program that queries JVM and find the cpu utilization(%) of a java class and methods running in it .
| 1 |
11,490,384 | 07/15/2012 07:59:26 | 1,493,470 | 06/30/2012 19:29:08 | 1 | 0 | CS193P Assignment 3, Communication between two ViewControllers | Ok, I know that the model for the new graphing vc is going to be a subclass of the calculator brain, but how do I get the program stack of the CalculatorBrain from the old VC to the GraphingBrain of my new VC? DO I have to go down the stack on the Storyboard-segue?
I have the pinching and panning on the new axes setup, as well as the delegate to communicate between the new graph brain and graph vc. But isn't my programStack that the user typed in before "trapped" in the old MVC?
I think I've got the concept down, but I don't see the way for that communication to occur.
Thanks in advance! | objective-c | uiviewcontroller | protocols | communication | cs193p | null | open | CS193P Assignment 3, Communication between two ViewControllers
===
Ok, I know that the model for the new graphing vc is going to be a subclass of the calculator brain, but how do I get the program stack of the CalculatorBrain from the old VC to the GraphingBrain of my new VC? DO I have to go down the stack on the Storyboard-segue?
I have the pinching and panning on the new axes setup, as well as the delegate to communicate between the new graph brain and graph vc. But isn't my programStack that the user typed in before "trapped" in the old MVC?
I think I've got the concept down, but I don't see the way for that communication to occur.
Thanks in advance! | 0 |
4,019,334 | 10/25/2010 22:20:24 | 211,327 | 11/15/2009 06:26:46 | 81 | 3 | What’s the JavaFX story? | I hear JavaFX was a horrible failure.
What was it exactly?
What did it try to accomplish?
Why and how did it fail? | java | history | javafx | null | null | 10/26/2010 00:06:32 | not a real question | What’s the JavaFX story?
===
I hear JavaFX was a horrible failure.
What was it exactly?
What did it try to accomplish?
Why and how did it fail? | 1 |
7,742,199 | 10/12/2011 15:04:16 | 645,226 | 03/04/2011 18:17:33 | 562 | 49 | Which is the best resource to learn Google DART? | Apart from http://www.dartlang.org/ which is the best website to learn Google DART? Any tutorials? Any good book for it?
Also, is it necessary to have any prior knowledge of Javascript to learn it? | dart | google-dart | null | null | null | 04/23/2012 17:51:15 | not constructive | Which is the best resource to learn Google DART?
===
Apart from http://www.dartlang.org/ which is the best website to learn Google DART? Any tutorials? Any good book for it?
Also, is it necessary to have any prior knowledge of Javascript to learn it? | 4 |
10,345,072 | 04/27/2012 05:11:56 | 1,351,241 | 04/23/2012 12:02:01 | 1 | 0 | Difference between web server and application server | Can any body explain me the difference between application server and web server ? any answer is welcome . Thank you . | server | application | web | null | null | 04/29/2012 09:27:02 | not a real question | Difference between web server and application server
===
Can any body explain me the difference between application server and web server ? any answer is welcome . Thank you . | 1 |
408,654 | 01/03/2009 05:27:07 | 9,266 | 09/15/2008 18:14:08 | 486 | 25 | WinForms: Tying actions together | I remember back when I used to do C++ Builder apps, you could create an action, then associate a menu item or context menu item, etc to the action. That way if you dis something like disable the action , the associated menu items would all be disabled. Is there something like that in a .net 2 winforms app? | c# | .net-2.0 | null | null | null | null | open | WinForms: Tying actions together
===
I remember back when I used to do C++ Builder apps, you could create an action, then associate a menu item or context menu item, etc to the action. That way if you dis something like disable the action , the associated menu items would all be disabled. Is there something like that in a .net 2 winforms app? | 0 |
7,121,390 | 08/19/2011 12:13:56 | 861,059 | 07/25/2011 07:11:21 | 1 | 0 | wamp mySQL error | I have recently installed Windows Web Matrix in order to use Joomla but then I was instructed to download wamp instead. However I had problems installing it and then I figured that it was because Web Matrix was still installed. Therefore, I un-installed it and all the components it added.
Then, I tried re-installing wamp and it worked. However, I am having problems.
I can enter localhost as seen:
https://skydrive.live.com/#!/?cid=c1c6d940227d72e6&sc=photos&nl=1&uc=3&id=C1C6D940227D72E6%21228!cid=C1C6D940227D72E6&id=C1C6D940227D72E6%21231&sc=photos
... but I can't enter phpMyAdmin :
https://skydrive.live.com/#!/?cid=c1c6d940227d72e6&sc=photos&nl=1&uc=3&id=C1C6D940227D72E6%21228!cid=C1C6D940227D72E6&id=C1C6D940227D72E6%21229&sc=photos
I have a feeling I might have deleted something related to mySQL when I deleted the programs by WebMatrix but I'm not certain.
Does anyone have any clue as to how I can get phpMyAdmin to work for me?
Thanks :)
| mysql | phpmyadmin | wamp | wampserver | mysql-error-1045 | 08/21/2011 12:41:01 | not a real question | wamp mySQL error
===
I have recently installed Windows Web Matrix in order to use Joomla but then I was instructed to download wamp instead. However I had problems installing it and then I figured that it was because Web Matrix was still installed. Therefore, I un-installed it and all the components it added.
Then, I tried re-installing wamp and it worked. However, I am having problems.
I can enter localhost as seen:
https://skydrive.live.com/#!/?cid=c1c6d940227d72e6&sc=photos&nl=1&uc=3&id=C1C6D940227D72E6%21228!cid=C1C6D940227D72E6&id=C1C6D940227D72E6%21231&sc=photos
... but I can't enter phpMyAdmin :
https://skydrive.live.com/#!/?cid=c1c6d940227d72e6&sc=photos&nl=1&uc=3&id=C1C6D940227D72E6%21228!cid=C1C6D940227D72E6&id=C1C6D940227D72E6%21229&sc=photos
I have a feeling I might have deleted something related to mySQL when I deleted the programs by WebMatrix but I'm not certain.
Does anyone have any clue as to how I can get phpMyAdmin to work for me?
Thanks :)
| 1 |
11,558,203 | 07/19/2012 09:51:10 | 1,528,800 | 07/16/2012 11:46:09 | 1 | 0 | uncaught syntax error | I am using following code for local storage.
for(int i=0; i< files.length; i++)
{
System.out.println("base = " + files[i].getName() + "\n i=" +i + "\n");
AudioFile f = AudioFileIO.read(files[i]);
Tag tag = f.getTag();
//AudioHeader h = f.getAudioHeader();
int l = f.getAudioHeader().getTrackLength();
String s1 = tag.getFirst(FieldKey.ALBUM);
out.print("writeToStorage("+s1+","+s1+");");
}
getting uncaught syntex erroe: unexpected identifer as a error. | javascript | null | null | null | null | null | open | uncaught syntax error
===
I am using following code for local storage.
for(int i=0; i< files.length; i++)
{
System.out.println("base = " + files[i].getName() + "\n i=" +i + "\n");
AudioFile f = AudioFileIO.read(files[i]);
Tag tag = f.getTag();
//AudioHeader h = f.getAudioHeader();
int l = f.getAudioHeader().getTrackLength();
String s1 = tag.getFirst(FieldKey.ALBUM);
out.print("writeToStorage("+s1+","+s1+");");
}
getting uncaught syntex erroe: unexpected identifer as a error. | 0 |
5,161,544 | 03/01/2011 23:10:01 | 432,056 | 08/26/2010 16:03:09 | 40 | 4 | Android: Android 2.3.3 how to take screenshot without root? | I've been waiting for this feature.
Android 2.3.3 allows to take screenshot without root.
http://mobiputing.com/2011/03/google-android-2-3-3-adds-native-screenshot-support-may-break-google-voice/
Can you programmatically take screenshot? If so how?
Or is it only manually (like Home + Power button) like Apple? | android | screenshot | null | null | null | null | open | Android: Android 2.3.3 how to take screenshot without root?
===
I've been waiting for this feature.
Android 2.3.3 allows to take screenshot without root.
http://mobiputing.com/2011/03/google-android-2-3-3-adds-native-screenshot-support-may-break-google-voice/
Can you programmatically take screenshot? If so how?
Or is it only manually (like Home + Power button) like Apple? | 0 |
6,105,921 | 05/24/2011 05:09:43 | 767,125 | 05/24/2011 05:07:35 | 1 | 0 | Attempting to use gettext to internationalize a php site | Okay, I have the following PHP code:
<?php
$locale = "es";
//$locale = $_SERVER["HTTP_ACCEPT_LANGUAGE"];
//if (isSet($_GET["locale"])) $locale = $_GET["locale"];
putenv("LC_ALL=$locale");
putenv("LANGUAGE=$locale");
setlocale(LC_ALL, $locale);
bindtextdomain("messages", "./locale");
bind_textdomain_codeset("messages", 'UTF-8');
textdomain("messages");
echo(getenv("LC_ALL"));
echo("<br>");
echo gettext("Hello World!");
?>
I have created Spanish messages.po and messages.mo files and stored them in a subdirectory in the directory where the above code is. The path to said directory is:
locale/es/LC_MESSAGES
according to phpinfo, gettext is enabled on the web server I am on (hosted by A Small Orange).
Calling the page shows the getenv call returns 'es', but the original English string comes out, not the expected Spanish. I have also tried with _("Hello World!"), also to no avail.
I get no warnings, no errors, no nothing. So, I am at a complete loss as to how to even troubleshoot where this may be failing.
Any guidance would be greatly appreciated. | php | internationalization | gettext | null | null | null | open | Attempting to use gettext to internationalize a php site
===
Okay, I have the following PHP code:
<?php
$locale = "es";
//$locale = $_SERVER["HTTP_ACCEPT_LANGUAGE"];
//if (isSet($_GET["locale"])) $locale = $_GET["locale"];
putenv("LC_ALL=$locale");
putenv("LANGUAGE=$locale");
setlocale(LC_ALL, $locale);
bindtextdomain("messages", "./locale");
bind_textdomain_codeset("messages", 'UTF-8');
textdomain("messages");
echo(getenv("LC_ALL"));
echo("<br>");
echo gettext("Hello World!");
?>
I have created Spanish messages.po and messages.mo files and stored them in a subdirectory in the directory where the above code is. The path to said directory is:
locale/es/LC_MESSAGES
according to phpinfo, gettext is enabled on the web server I am on (hosted by A Small Orange).
Calling the page shows the getenv call returns 'es', but the original English string comes out, not the expected Spanish. I have also tried with _("Hello World!"), also to no avail.
I get no warnings, no errors, no nothing. So, I am at a complete loss as to how to even troubleshoot where this may be failing.
Any guidance would be greatly appreciated. | 0 |
6,591,747 | 07/06/2011 04:59:54 | 830,805 | 07/06/2011 03:19:47 | 4 | 0 | Im getting a blank page in php | Hello im trying to create a php email activation system for my users and when i run my script it returns a blank page and my database was not update any help is appreciated
Here is my code:
<?php
$host="localhost";
$username="root";
$password="power1";
$db_name="members";
$tbl_name="users";
$link = mysql_connect($host, $username, $password)or die("cannot connect. Please contact us");
mysql_select_db($db_name)or die("cannot select DB. Please contact us");
$queryString = $_SERVER['QUERY_STRING'];
if(isset($_SESSION[$queryString])) {
$query = "SELECT * FROM users WHERE email='$_SESSION[$queryString]'";
$result = mysql_query($query) or die(mysql_error());
while($row = mysql_fetch_array($result)){
if ($queryString == $row[activationkey]){
echo "Congratulations! You have succesfully activated you account. You may now login.";
$sql = ("UPDATE users SET activationkey='' AND status='activated' WHERE username=".$row['username']);
if (!mysql_query($sql)) {
die('Error: ' . mysql_error());
}
}
}
}
?> | php | null | null | null | null | 07/07/2011 02:58:38 | not a real question | Im getting a blank page in php
===
Hello im trying to create a php email activation system for my users and when i run my script it returns a blank page and my database was not update any help is appreciated
Here is my code:
<?php
$host="localhost";
$username="root";
$password="power1";
$db_name="members";
$tbl_name="users";
$link = mysql_connect($host, $username, $password)or die("cannot connect. Please contact us");
mysql_select_db($db_name)or die("cannot select DB. Please contact us");
$queryString = $_SERVER['QUERY_STRING'];
if(isset($_SESSION[$queryString])) {
$query = "SELECT * FROM users WHERE email='$_SESSION[$queryString]'";
$result = mysql_query($query) or die(mysql_error());
while($row = mysql_fetch_array($result)){
if ($queryString == $row[activationkey]){
echo "Congratulations! You have succesfully activated you account. You may now login.";
$sql = ("UPDATE users SET activationkey='' AND status='activated' WHERE username=".$row['username']);
if (!mysql_query($sql)) {
die('Error: ' . mysql_error());
}
}
}
}
?> | 1 |
11,369,058 | 07/06/2012 20:12:27 | 777,706 | 05/31/2011 12:57:54 | 203 | 13 | libSVM for iOS? | Has anybody been able to compile libSVM for iOS? I haven't found any guide online, or anybody reporting how fast it is on the new devices. Could anybody point me to the right directions in order to get libSVM running on iOS (if that's possible at all)?
Thank you. | ios | machine-learning | svm | libsvm | null | null | open | libSVM for iOS?
===
Has anybody been able to compile libSVM for iOS? I haven't found any guide online, or anybody reporting how fast it is on the new devices. Could anybody point me to the right directions in order to get libSVM running on iOS (if that's possible at all)?
Thank you. | 0 |
10,883,387 | 06/04/2012 14:54:11 | 1,435,323 | 06/04/2012 13:54:51 | 3 | 0 | How to time how long a Python program takes to run? | Is there a simple way to time a Python program's execution? | python | time | null | null | null | null | open | How to time how long a Python program takes to run?
===
Is there a simple way to time a Python program's execution? | 0 |
9,453,606 | 02/26/2012 13:50:06 | 1,162,333 | 01/21/2012 13:53:21 | 10 | 0 | UIBarButtonItem appearance not working on the device | I ran into the following problem:
I'm customizing the whole appearance of my app. Now I want to change the background of the backbuttons in the navigationbar. If I run my code on the simulator, it works. But if I run it on the device it doesn't change anything. How is this possible?
I'm running the app on my iPhone 4S iOS 5.0.1
#import "test.h"
#import "InfoButton.h"
@implementation test
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
- (void)viewDidLoad {
if([self.navigationController.navigationBar respondsToSelector:@selector(setBackgroundImage:forBarMetrics:)] ) {
//iOS 5 new UINavigationBar custom background
UIImage *navi = [UIImage imageNamed:@"navbar.png"];
[self.navigationController.navigationBar setBackgroundImage:navi forBarMetrics: UIBarMetricsDefault];
UIImage *toolbarBackButtonBackgroundPortrait = [[UIImage imageNamed:@"nav_back.png"] resizableImageWithCapInsets:UIEdgeInsetsMake(0, 17, 0, 6)];
[[UIBarButtonItem appearance] setBackButtonBackgroundImage:toolbarBackButtonBackgroundPortrait forState:UIControlStateNormal barMetrics:UIBarMetricsDefault];
}
[super viewDidLoad];
UIButton * infoDarkButtonType = [[UIButton buttonWithType:UIButtonTypeInfoLight] retain];
infoDarkButtonType.frame = CGRectMake(0.0, 0.0, 30.0, 25.0);
infoDarkButtonType.backgroundColor = [UIColor clearColor];
[infoDarkButtonType addTarget:self action:@selector(infoButtonPressed:) forControlEvents:UIControlEventTouchUpInside];
UIBarButtonItem *infoButton = [[UIBarButtonItem alloc] initWithCustomView:infoDarkButtonType];
self.navigationItem.rightBarButtonItem = infoButton;
[infoDarkButtonType release];
[infoButton release];
}
| objective-c | ios5 | xcode4.2 | null | null | null | open | UIBarButtonItem appearance not working on the device
===
I ran into the following problem:
I'm customizing the whole appearance of my app. Now I want to change the background of the backbuttons in the navigationbar. If I run my code on the simulator, it works. But if I run it on the device it doesn't change anything. How is this possible?
I'm running the app on my iPhone 4S iOS 5.0.1
#import "test.h"
#import "InfoButton.h"
@implementation test
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
- (void)viewDidLoad {
if([self.navigationController.navigationBar respondsToSelector:@selector(setBackgroundImage:forBarMetrics:)] ) {
//iOS 5 new UINavigationBar custom background
UIImage *navi = [UIImage imageNamed:@"navbar.png"];
[self.navigationController.navigationBar setBackgroundImage:navi forBarMetrics: UIBarMetricsDefault];
UIImage *toolbarBackButtonBackgroundPortrait = [[UIImage imageNamed:@"nav_back.png"] resizableImageWithCapInsets:UIEdgeInsetsMake(0, 17, 0, 6)];
[[UIBarButtonItem appearance] setBackButtonBackgroundImage:toolbarBackButtonBackgroundPortrait forState:UIControlStateNormal barMetrics:UIBarMetricsDefault];
}
[super viewDidLoad];
UIButton * infoDarkButtonType = [[UIButton buttonWithType:UIButtonTypeInfoLight] retain];
infoDarkButtonType.frame = CGRectMake(0.0, 0.0, 30.0, 25.0);
infoDarkButtonType.backgroundColor = [UIColor clearColor];
[infoDarkButtonType addTarget:self action:@selector(infoButtonPressed:) forControlEvents:UIControlEventTouchUpInside];
UIBarButtonItem *infoButton = [[UIBarButtonItem alloc] initWithCustomView:infoDarkButtonType];
self.navigationItem.rightBarButtonItem = infoButton;
[infoDarkButtonType release];
[infoButton release];
}
| 0 |
7,950,437 | 10/31/2011 06:06:11 | 978,180 | 10/04/2011 09:45:42 | 3 | 0 | Tund connector error : ERROR/TundConnector(1475): Communications error in android | I am getting the below error
10-28 15:55:48.252: ERROR/NetlinkEvent(1347): NetlinkEvent::FindParam(): Parameter 'UDEV_LOG' not found
10-28 15:55:48.442: ERROR/NetlinkEvent(1347): NetlinkEvent::FindParam(): Parameter 'UDEV_LOG' not found
10-28 15:55:49.082: ERROR/TundConnector(1475): Communications error
10-28 15:55:49.082: ERROR/TundConnector(1475): java.io.IOException: No such file or directory
10-28 15:55:49.082: ERROR/TundConnector(1475): at android.net.LocalSocketImpl.connectLocal(Native Method)
10-28 15:55:49.082: ERROR/TundConnector(1475): at android.net.LocalSocketImpl.connect(LocalSocketImpl.java:238)
10-28 15:55:49.082: ERROR/TundConnector(1475): at android.net.LocalSocket.connect(LocalSocket.java:98)
10-28 15:55:49.082: ERROR/TundConnector(1475): at com.android.server.NativeDaemonConnector.listenToSocket(NativeDaemonConnector.java:99)
10-28 15:55:49.082: ERROR/TundConnector(1475): at com.android.server.NativeDaemonConnector.run(NativeDaemonConnector.java:83)
10-28 15:55:49.082: ERROR/TundConnector(1475): at java.lang.Thread.run(Thread.java:1019)
10-28 15:55:49.082: ERROR/TundConnector(1475): Error in NativeDaemonConnector
10-28 15:55:49.082: ERROR/TundConnector(1475): java.io.IOException: No such file or directory
10-28 15:55:49.082: ERROR/TundConnector(1475): at android.net.LocalSocketImpl.connectLocal(Native Method)
10-28 15:55:49.082: ERROR/TundConnector(1475): at android.net.LocalSocketImpl.connect(LocalSocketImpl.java:238)
10-28 15:55:49.082: ERROR/TundConnector(1475): at android.net.LocalSocket.connect(LocalSocket.java:98)
10-28 15:55:49.082: ERROR/TundConnector(1475): at com.android.server.NativeDaemonConnector.listenToSocket(NativeDaemonConnector.java:99)
10-28 15:55:49.082: ERROR/TundConnector(1475): at com.android.server.NativeDaemonConnector.run(NativeDaemonConnector.java:83)
10-28 15:55:49.082: ERROR/TundConnector(1475): at java.lang.Thread.run(Thread.java:1019)
Is there any settings needs to be done or is it because of the 3G or wifi connectivity?
Please confirm.
Thanks,
Pallavi Roy | android | null | null | null | null | null | open | Tund connector error : ERROR/TundConnector(1475): Communications error in android
===
I am getting the below error
10-28 15:55:48.252: ERROR/NetlinkEvent(1347): NetlinkEvent::FindParam(): Parameter 'UDEV_LOG' not found
10-28 15:55:48.442: ERROR/NetlinkEvent(1347): NetlinkEvent::FindParam(): Parameter 'UDEV_LOG' not found
10-28 15:55:49.082: ERROR/TundConnector(1475): Communications error
10-28 15:55:49.082: ERROR/TundConnector(1475): java.io.IOException: No such file or directory
10-28 15:55:49.082: ERROR/TundConnector(1475): at android.net.LocalSocketImpl.connectLocal(Native Method)
10-28 15:55:49.082: ERROR/TundConnector(1475): at android.net.LocalSocketImpl.connect(LocalSocketImpl.java:238)
10-28 15:55:49.082: ERROR/TundConnector(1475): at android.net.LocalSocket.connect(LocalSocket.java:98)
10-28 15:55:49.082: ERROR/TundConnector(1475): at com.android.server.NativeDaemonConnector.listenToSocket(NativeDaemonConnector.java:99)
10-28 15:55:49.082: ERROR/TundConnector(1475): at com.android.server.NativeDaemonConnector.run(NativeDaemonConnector.java:83)
10-28 15:55:49.082: ERROR/TundConnector(1475): at java.lang.Thread.run(Thread.java:1019)
10-28 15:55:49.082: ERROR/TundConnector(1475): Error in NativeDaemonConnector
10-28 15:55:49.082: ERROR/TundConnector(1475): java.io.IOException: No such file or directory
10-28 15:55:49.082: ERROR/TundConnector(1475): at android.net.LocalSocketImpl.connectLocal(Native Method)
10-28 15:55:49.082: ERROR/TundConnector(1475): at android.net.LocalSocketImpl.connect(LocalSocketImpl.java:238)
10-28 15:55:49.082: ERROR/TundConnector(1475): at android.net.LocalSocket.connect(LocalSocket.java:98)
10-28 15:55:49.082: ERROR/TundConnector(1475): at com.android.server.NativeDaemonConnector.listenToSocket(NativeDaemonConnector.java:99)
10-28 15:55:49.082: ERROR/TundConnector(1475): at com.android.server.NativeDaemonConnector.run(NativeDaemonConnector.java:83)
10-28 15:55:49.082: ERROR/TundConnector(1475): at java.lang.Thread.run(Thread.java:1019)
Is there any settings needs to be done or is it because of the 3G or wifi connectivity?
Please confirm.
Thanks,
Pallavi Roy | 0 |
6,664,364 | 07/12/2011 12:46:48 | 25,645 | 10/06/2008 22:10:23 | 1,393 | 17 | Are there GUI component libraries for Cocoa OSX? | My Cocoa OSX applications are ugly. Are there libraries out there of better UI components?
Maybe also a good website to learn how to do good designs for Cocoa? (not iOS) | cocoa | osx | design | null | null | 07/13/2011 02:15:43 | not constructive | Are there GUI component libraries for Cocoa OSX?
===
My Cocoa OSX applications are ugly. Are there libraries out there of better UI components?
Maybe also a good website to learn how to do good designs for Cocoa? (not iOS) | 4 |
9,575,766 | 03/05/2012 23:35:55 | 267,416 | 02/05/2010 21:31:18 | 351 | 6 | Really Simple Open Source Java games | I need a simple open source Java game to assign it as a programming task to my friend who is learning Java and to be as a reference for him while re-implementing it. He wants to get his hands dirty with a real project but he is still in his first steps in learning the language so don't expect him to make a big game :)
EDIT: the game doesn't matter to be a console based game or a gui game. All what I need is giving him a good programming practice. | java | open-source | source | null | null | 03/08/2012 17:16:28 | off topic | Really Simple Open Source Java games
===
I need a simple open source Java game to assign it as a programming task to my friend who is learning Java and to be as a reference for him while re-implementing it. He wants to get his hands dirty with a real project but he is still in his first steps in learning the language so don't expect him to make a big game :)
EDIT: the game doesn't matter to be a console based game or a gui game. All what I need is giving him a good programming practice. | 2 |
6,088,100 | 05/22/2011 13:05:52 | 743,846 | 04/03/2010 11:06:18 | 6 | 1 | Make firefox-addons uninstallable | Anyone knows how to disable the uninstall button when creating an addon?
| firefox-addon | uninstall | null | null | null | 05/22/2011 13:08:19 | not a real question | Make firefox-addons uninstallable
===
Anyone knows how to disable the uninstall button when creating an addon?
| 1 |
7,026,114 | 08/11/2011 12:48:12 | 696,034 | 04/07/2011 04:05:08 | 414 | 47 | jQueryUI .extend woes | I'm trying to figure out how to fix [this][1] code for jQueryUI 1.8.5 and jQuery 1.5.1 and am out of luck with such advanced stuff, can anyone lend a hand?
The problem is with the code below:
$.extend($.ui.boxer, {
defaults: $.extend({}, $.ui.mouse.defaults, {
appendTo: 'body',
distance: 0
})
});
It doesn't initialize options with appendTo and distance values for some reason.
[1]: http://jsbin.com/aqowa/edit#javascript,html | javascript | jquery | jquery-ui | null | null | null | open | jQueryUI .extend woes
===
I'm trying to figure out how to fix [this][1] code for jQueryUI 1.8.5 and jQuery 1.5.1 and am out of luck with such advanced stuff, can anyone lend a hand?
The problem is with the code below:
$.extend($.ui.boxer, {
defaults: $.extend({}, $.ui.mouse.defaults, {
appendTo: 'body',
distance: 0
})
});
It doesn't initialize options with appendTo and distance values for some reason.
[1]: http://jsbin.com/aqowa/edit#javascript,html | 0 |
4,945,647 | 02/09/2011 13:42:58 | 67,872 | 02/18/2009 15:06:46 | 1,024 | 87 | JavaScript Web Development tools suggestion? | I'm developing in C# ASP.NET and my lines of JavaScript start to grow quite a lot and I feel there most be some better tools for the actual JS development rather than working in Visual Studio.
Would appreciate recommendations of tools or plug ins for VS2010 and I prefer Open Source/Free tools.
Thanks,
Stefan
| javascript | .net | ide | null | null | 08/30/2011 13:35:06 | not constructive | JavaScript Web Development tools suggestion?
===
I'm developing in C# ASP.NET and my lines of JavaScript start to grow quite a lot and I feel there most be some better tools for the actual JS development rather than working in Visual Studio.
Would appreciate recommendations of tools or plug ins for VS2010 and I prefer Open Source/Free tools.
Thanks,
Stefan
| 4 |
7,699,160 | 10/08/2011 19:13:48 | 979,617 | 10/05/2011 03:16:33 | 14 | 1 | PHP: Get part of PHP of the url | So i have the code and i want the name Super as the url < href=""
<?php
include_once 'imdb.class.php';
$oIMDB = new IMDB(super);
if ($oIMDB->isReady) {
echo '<a href="some.com/super">
else {
echo '<p>Movie not found!</p>';
}
?>
| php | null | null | null | null | 10/08/2011 22:01:40 | not a real question | PHP: Get part of PHP of the url
===
So i have the code and i want the name Super as the url < href=""
<?php
include_once 'imdb.class.php';
$oIMDB = new IMDB(super);
if ($oIMDB->isReady) {
echo '<a href="some.com/super">
else {
echo '<p>Movie not found!</p>';
}
?>
| 1 |
6,800,164 | 07/23/2011 11:54:16 | 859,247 | 07/23/2011 11:24:03 | 1 | 0 | [Java]Sudoku- Region testing | I read through about 10 or so links about sudoku's before I even posted this, so I hope that there isn't some blatant answer to this lurking right around here waiting to make me look silly...
So the last few days I've taken it upon myself to create a sudoku generator, using a 'brute-force' randomity approach. I have been able to check the x / y axis for duplicate numbers just fine using the code:
for(l=0; l<9; l++){//Makes all vertical work.
if(sudoku[l][j] == temp){
isUsed=true;
}
}
for(m=0; m<9; m++){//makes all horizontal work
if(sudoku[i][m] == temp){
isUsed=true;
}
}
I then decided to implement the 'box' or 'region' checking (where you check every 3x3 square from the origin) and I just can't seem to wrap my head around the code. Here's what I've done so far... fair warning it's a mess; I just can't quite figure out where my logic error lie (for the record the program will run with this code, but will not check regions properly)
rowbase = i-(i%3);
if(i==2 || i==5 || i==8 ){
if(rowbase == 0 || rowbase == 3 || rowbase == 6){
isUsed= RegionCheck.RegCheck(rowbase, sudoku);
}
}
Contents of regionCheck.java:
boolean okay = false;
int[] regionUsed = new int[9];
int i=0, j=0, regionTester=0, counter=0, numcount;
for (i=regionTester; i<regionTester+3; i++){
for (; j<3; j++){
regionUsed[counter]=sudoku[i][j];
counter++;
}
}
for(i=0; i<9; i++){
numcount=regionUsed[i];
for(j=0; j<9; j++){
if(j==i){
//null
}
else if(numcount == regionUsed[j]){
okay=false;
}
}
}
return okay;
Somewhere along the way I'm just getting lost and not understanding how to 'select' a region and iterate through regions.
Full source here: http://ideone.com/FYLwm
Any help on simply how to 'select' a region for testing and then iterate through it would be greatly appreciated as I'm really out of ideas.
Sorry about being so prolix.
--HunderingThooves. | testing | generator | region | sudoku | null | null | open | [Java]Sudoku- Region testing
===
I read through about 10 or so links about sudoku's before I even posted this, so I hope that there isn't some blatant answer to this lurking right around here waiting to make me look silly...
So the last few days I've taken it upon myself to create a sudoku generator, using a 'brute-force' randomity approach. I have been able to check the x / y axis for duplicate numbers just fine using the code:
for(l=0; l<9; l++){//Makes all vertical work.
if(sudoku[l][j] == temp){
isUsed=true;
}
}
for(m=0; m<9; m++){//makes all horizontal work
if(sudoku[i][m] == temp){
isUsed=true;
}
}
I then decided to implement the 'box' or 'region' checking (where you check every 3x3 square from the origin) and I just can't seem to wrap my head around the code. Here's what I've done so far... fair warning it's a mess; I just can't quite figure out where my logic error lie (for the record the program will run with this code, but will not check regions properly)
rowbase = i-(i%3);
if(i==2 || i==5 || i==8 ){
if(rowbase == 0 || rowbase == 3 || rowbase == 6){
isUsed= RegionCheck.RegCheck(rowbase, sudoku);
}
}
Contents of regionCheck.java:
boolean okay = false;
int[] regionUsed = new int[9];
int i=0, j=0, regionTester=0, counter=0, numcount;
for (i=regionTester; i<regionTester+3; i++){
for (; j<3; j++){
regionUsed[counter]=sudoku[i][j];
counter++;
}
}
for(i=0; i<9; i++){
numcount=regionUsed[i];
for(j=0; j<9; j++){
if(j==i){
//null
}
else if(numcount == regionUsed[j]){
okay=false;
}
}
}
return okay;
Somewhere along the way I'm just getting lost and not understanding how to 'select' a region and iterate through regions.
Full source here: http://ideone.com/FYLwm
Any help on simply how to 'select' a region for testing and then iterate through it would be greatly appreciated as I'm really out of ideas.
Sorry about being so prolix.
--HunderingThooves. | 0 |
4,032,982 | 10/27/2010 12:09:53 | 488,779 | 10/27/2010 12:09:53 | 1 | 0 | Does anyone have any tips on submitting to clients proposals for iPhone apps? | I'm just starting out with a friend creating iPhone apps and the biggest hurdle other than finding clients is knowing how to structure proposals for clients.
Is it the norm to write a 1, 2 or 3 page proposal? Obviously I don't want to bore the client just with the initial proposal (sales pitch with quote).
How should I break down the pricing? Should I be completely transparent and put the amount of hours for development, amount for design, amount for research and liaison with the company etc?
Does anyone know of any samples online?
Any help would be really gratefully appreciated. | iphone | application | clients | null | null | null | open | Does anyone have any tips on submitting to clients proposals for iPhone apps?
===
I'm just starting out with a friend creating iPhone apps and the biggest hurdle other than finding clients is knowing how to structure proposals for clients.
Is it the norm to write a 1, 2 or 3 page proposal? Obviously I don't want to bore the client just with the initial proposal (sales pitch with quote).
How should I break down the pricing? Should I be completely transparent and put the amount of hours for development, amount for design, amount for research and liaison with the company etc?
Does anyone know of any samples online?
Any help would be really gratefully appreciated. | 0 |
5,591,594 | 04/08/2011 07:01:03 | 623,193 | 02/18/2011 13:25:01 | 6 | 0 | how to convert XML file into sqllite file | i am retrieving data from XML file but the file contains more than 15000 records,so my app is getting slowed.so i want it to convert it into sqllite file (by using programmatically or by using any tool).please provide me any solution for it. | iphone | xml | sqlite | null | null | null | open | how to convert XML file into sqllite file
===
i am retrieving data from XML file but the file contains more than 15000 records,so my app is getting slowed.so i want it to convert it into sqllite file (by using programmatically or by using any tool).please provide me any solution for it. | 0 |
1,172,997 | 07/23/2009 16:38:19 | 128,245 | 06/24/2009 14:05:36 | 88 | 7 | unlisted reserved word? | I ran into a very strange behaviour in some of our PHP code today. We have a class for dealing with files. It's something like this:
class AFile {
//usual constructor, set and get functions, etc.
//...
public function save() {
//do some validation
//...
if($this->upload()) { //save the file to disk
$this->update_db(); //never reached this line
}
}
private function upload() {
//save the file to disk
//...
return ($success) ? true : false;
}
}
It looked pretty normal to us, but the $this->upload() function never returned anything but NULL. We checked that the correct function was running. We echoed out its return value before it returned. We tried only returning a true value or even a string. Everything was checking out right. But $this->upload still evaluated to NULL. Also, there was nothing in the logs and ERROR_ALL is on.
In exasperation we changed the function name to foo_upload. All of a sudden everything worked. "upload" is not in the list of [PHP reserved words][1]. Anyone have any thoughts why a class function named "upload" would fail?
[1]: http://us2.php.net/manual/en/reserved.keywords.php | php | return-value | null | null | null | null | open | unlisted reserved word?
===
I ran into a very strange behaviour in some of our PHP code today. We have a class for dealing with files. It's something like this:
class AFile {
//usual constructor, set and get functions, etc.
//...
public function save() {
//do some validation
//...
if($this->upload()) { //save the file to disk
$this->update_db(); //never reached this line
}
}
private function upload() {
//save the file to disk
//...
return ($success) ? true : false;
}
}
It looked pretty normal to us, but the $this->upload() function never returned anything but NULL. We checked that the correct function was running. We echoed out its return value before it returned. We tried only returning a true value or even a string. Everything was checking out right. But $this->upload still evaluated to NULL. Also, there was nothing in the logs and ERROR_ALL is on.
In exasperation we changed the function name to foo_upload. All of a sudden everything worked. "upload" is not in the list of [PHP reserved words][1]. Anyone have any thoughts why a class function named "upload" would fail?
[1]: http://us2.php.net/manual/en/reserved.keywords.php | 0 |
11,469,635 | 07/13/2012 11:29:48 | 991,096 | 10/12/2011 09:03:24 | 1 | 0 | common language for any RDBMS technology | we are looking for a common language for any RDBMS technology.means if i write q query in SQL SERVER that query have to work on any RDBMS like oracle ,mysql....please help me. | sql-server-2008 | null | null | null | null | 07/15/2012 00:37:01 | not constructive | common language for any RDBMS technology
===
we are looking for a common language for any RDBMS technology.means if i write q query in SQL SERVER that query have to work on any RDBMS like oracle ,mysql....please help me. | 4 |
5,881,601 | 05/04/2011 09:55:28 | 724,982 | 04/26/2011 08:10:21 | 22 | 0 | C# run program from server | Can i run a c# winform program from my internet server?For example i install the program my server.after that i want to run this program other computer unless install framework to client | c# | null | null | null | null | 05/09/2011 01:18:41 | not a real question | C# run program from server
===
Can i run a c# winform program from my internet server?For example i install the program my server.after that i want to run this program other computer unless install framework to client | 1 |
3,040,698 | 06/14/2010 20:31:55 | 266,453 | 02/04/2010 18:14:02 | 28 | 1 | CSS three column layout, liquid center, no left-margin! | I am all in favor of CSS based layouts, but this one I just can't figure out. With a table it is oh-so-easy:
<html>
<head><title>Three Column</title></head>
<body>
<p>Test</p>
<table style="width: 100%; border: 1px solid black; min-height: 300px;">
<tr>
<td style="border: 1px solid green;" colspan="3">Header</td>
</tr>
<tr>
<td style="border: 1px solid green; width: 150px;" rowspan="2">Left</td>
<td style="border: 1px solid yellow;">Content</td>
<td style="border: 1px solid blue; width: 200px;" rowspan="2">Right</td>
</tr>
<tr>
<td style="border: 1px solid fuchsia;">Additional stuff</td>
</tr>
<tr><td style="border: 1px solid green;" colspan="3">Footer</td></tr>
</body>
<html>
- Left is fixed width
- Right is fixed width
- Content is liquid
- Additional stuff sits beneath content
Now here is the important part: "Left" **may not exist**. Again this is easy with the table. Delete the column and "Content" expands. Beautiful.
I have looked through many examples (and "holy grails") of liquid and table less three-column CSS based layouts, but I have not found one which is not using some kind of margin-left for the middle column ("Content"). Any margin-left will suck once "Left" is gone as "Content" will just stay at it's place.
I'm just about to switch to old school table based layout for this problem, so I'm hoping someone has some idea - I don't care about excess markup, wrappers and the like, I would just like to know how to solve this with plain CSS. Btw: look at how easy equal height columns are...
Cheers
PS: No CSS3 please | css | columns | null | null | null | null | open | CSS three column layout, liquid center, no left-margin!
===
I am all in favor of CSS based layouts, but this one I just can't figure out. With a table it is oh-so-easy:
<html>
<head><title>Three Column</title></head>
<body>
<p>Test</p>
<table style="width: 100%; border: 1px solid black; min-height: 300px;">
<tr>
<td style="border: 1px solid green;" colspan="3">Header</td>
</tr>
<tr>
<td style="border: 1px solid green; width: 150px;" rowspan="2">Left</td>
<td style="border: 1px solid yellow;">Content</td>
<td style="border: 1px solid blue; width: 200px;" rowspan="2">Right</td>
</tr>
<tr>
<td style="border: 1px solid fuchsia;">Additional stuff</td>
</tr>
<tr><td style="border: 1px solid green;" colspan="3">Footer</td></tr>
</body>
<html>
- Left is fixed width
- Right is fixed width
- Content is liquid
- Additional stuff sits beneath content
Now here is the important part: "Left" **may not exist**. Again this is easy with the table. Delete the column and "Content" expands. Beautiful.
I have looked through many examples (and "holy grails") of liquid and table less three-column CSS based layouts, but I have not found one which is not using some kind of margin-left for the middle column ("Content"). Any margin-left will suck once "Left" is gone as "Content" will just stay at it's place.
I'm just about to switch to old school table based layout for this problem, so I'm hoping someone has some idea - I don't care about excess markup, wrappers and the like, I would just like to know how to solve this with plain CSS. Btw: look at how easy equal height columns are...
Cheers
PS: No CSS3 please | 0 |
10,977,454 | 06/11/2012 09:27:08 | 169,165 | 09/06/2009 05:50:45 | 98 | 0 | Pure c++ app for Android and its performance | Can I write a pure C++ app for Android? (for example, using NDK?)
Considering there's no difference of functionality, is pure Android C++ app faster and consumes lesser memory than Android Java app? In just my guess, I guess it is YES because C++ app won't do garbage collection which causes frame rate hiccup.
| android | c++ | performance | null | null | null | open | Pure c++ app for Android and its performance
===
Can I write a pure C++ app for Android? (for example, using NDK?)
Considering there's no difference of functionality, is pure Android C++ app faster and consumes lesser memory than Android Java app? In just my guess, I guess it is YES because C++ app won't do garbage collection which causes frame rate hiccup.
| 0 |
4,244,505 | 11/22/2010 10:35:50 | 251,160 | 01/14/2010 23:30:57 | 51 | 1 | Best Books or tutorials to be CakePHP Advanced Programmer | I started reading **Apress Beginning CakePHP From Novice to Professional 2008**
But I was wondering if there are any other books I should read or Important tutorials I should be doing to be able to build a complete, stable CakePHP project.
Simply put, What did you do to get better in CakePHP development, your footsteps and recommendations.
I'm coming from a Java, C#.NET Background. I also did the Linda.com Video Course for Learning PHP. | php | cakephp | null | null | null | 05/12/2012 17:08:00 | not constructive | Best Books or tutorials to be CakePHP Advanced Programmer
===
I started reading **Apress Beginning CakePHP From Novice to Professional 2008**
But I was wondering if there are any other books I should read or Important tutorials I should be doing to be able to build a complete, stable CakePHP project.
Simply put, What did you do to get better in CakePHP development, your footsteps and recommendations.
I'm coming from a Java, C#.NET Background. I also did the Linda.com Video Course for Learning PHP. | 4 |
11,489,552 | 07/15/2012 04:58:24 | 1,526,486 | 07/15/2012 04:53:46 | 1 | 0 | Invision Power Board 'Curse' Skins | Does anyone know how makes the IP.Board skins/themes for the 'Curse' forums like http://www.guildwars2guru.com/ and http://www.darthhater.com/?
Are they custom made?
Is there a company that makes skins similar to these that I can buy?
thanks,
Jack | forum | skin | invision-power-board | null | null | 07/15/2012 21:55:00 | off topic | Invision Power Board 'Curse' Skins
===
Does anyone know how makes the IP.Board skins/themes for the 'Curse' forums like http://www.guildwars2guru.com/ and http://www.darthhater.com/?
Are they custom made?
Is there a company that makes skins similar to these that I can buy?
thanks,
Jack | 2 |
6,037,289 | 05/17/2011 21:20:45 | 638,252 | 02/28/2011 19:24:36 | 51 | 0 | windows embedded vs linux | We are developing embedded device that will process video at very high speed. Device will have no UI, just receive and send video and data. For basic hardware we are planning to use PC motherboard which will communicate with custom devices like FPGA. What would you recommend for OS: Windows Embedded or Linux?
Considerations:
- We need to process video frames in real time. Processing must be very fast (which, I guess, excludes .Net).
- We have to develop drivers for PCIe and USB devices.
I am very interested in your opinion on which OS will minimize development cost. | windows-mobile | embedded-linux | null | null | null | 05/17/2011 22:06:25 | not a real question | windows embedded vs linux
===
We are developing embedded device that will process video at very high speed. Device will have no UI, just receive and send video and data. For basic hardware we are planning to use PC motherboard which will communicate with custom devices like FPGA. What would you recommend for OS: Windows Embedded or Linux?
Considerations:
- We need to process video frames in real time. Processing must be very fast (which, I guess, excludes .Net).
- We have to develop drivers for PCIe and USB devices.
I am very interested in your opinion on which OS will minimize development cost. | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.