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
6,750,827
07/19/2011 16:45:24
852,454
07/19/2011 16:45:24
1
0
displace an image vertically in matlab?
This image is in gray scale, i´ve already done a scanning to detect the first and the last pixels i would like to move to top, and put those points into an array but all i´ve gotten is two pixels displaced.
matlab
null
null
null
null
07/20/2011 11:26:30
not a real question
displace an image vertically in matlab? === This image is in gray scale, i´ve already done a scanning to detect the first and the last pixels i would like to move to top, and put those points into an array but all i´ve gotten is two pixels displaced.
1
5,002,395
02/15/2011 10:20:28
98,374
04/30/2009 08:54:46
73
4
Automatically indenting less (the css extention)
[Less](http://lesscss.org/), the CSS extension, let's you nest CSS rules. I'm looking for a way to automatically indent my less code. I'm sure that some combination of flags on [indent](http://www.gnu.org/software/indent/) will do the trick but the man page is 23 pages long.
css
less
indent
beautifier
null
null
open
Automatically indenting less (the css extention) === [Less](http://lesscss.org/), the CSS extension, let's you nest CSS rules. I'm looking for a way to automatically indent my less code. I'm sure that some combination of flags on [indent](http://www.gnu.org/software/indent/) will do the trick but the man page is 23 pages long.
0
10,881,703
06/04/2012 12:56:28
443,169
09/09/2010 07:35:00
13
1
add www to htaccess for contextdependant urls
I know about his RewriteEngine On RewriteCond %{HTTP_HOST} ^yourdomain\.net$ RewriteRule (.*) http://www.yourdomain.net/$1 [R=301,L] However, i do not know beforehand what the domainname will be (it can be one of about 30). Is it possible make yourdomain.com variable so it matches all 30 possible domains?
.htaccess
variables
null
null
null
06/05/2012 13:12:48
off topic
add www to htaccess for contextdependant urls === I know about his RewriteEngine On RewriteCond %{HTTP_HOST} ^yourdomain\.net$ RewriteRule (.*) http://www.yourdomain.net/$1 [R=301,L] However, i do not know beforehand what the domainname will be (it can be one of about 30). Is it possible make yourdomain.com variable so it matches all 30 possible domains?
2
8,069,926
11/09/2011 18:44:56
1,007,666
10/21/2011 18:25:40
6
0
What is the correct syntax for this query?
NSString *querySQL = [NSString stringWithFormat: @"SELECT address, phone FROM contacts WHERE name LIKE @0","%name.text%"];
sqlite
null
null
null
null
11/10/2011 09:15:18
too localized
What is the correct syntax for this query? === NSString *querySQL = [NSString stringWithFormat: @"SELECT address, phone FROM contacts WHERE name LIKE @0","%name.text%"];
3
4,977,353
02/12/2011 09:33:43
614,099
02/12/2011 09:33:43
1
0
how to open an aspx.cs file?
i have some files with extension aspx.cs. i tried opening them with visual studio c# 2008. but all that opens is the code page, and not any design page. what should i do? i have to work on that project. how to open those files, in which program/software? please help.
asp
null
null
null
null
null
open
how to open an aspx.cs file? === i have some files with extension aspx.cs. i tried opening them with visual studio c# 2008. but all that opens is the code page, and not any design page. what should i do? i have to work on that project. how to open those files, in which program/software? please help.
0
764,726
04/19/2009 02:44:33
54,964
01/14/2009 11:38:17
1,370
26
Accessing Multiple Files in VIM
The book "Unix in a Nutshell" discusses about accessing multiple files on pages 572-573. There seem to be very useful commands such as ":e", ":e #", ":e new_file", ":n files", ":args", ":prev" and ":n!". The commands confuse me: > ":n Edit next file in the list of files." > ":args Display list of files to be edited." > ":prev Edit previous file in the list of files." I cannot see no real list when I do ":args". There is only a small text at the corner. I would like to see all files that I accessed with ":e", ie a list of files in the buffer. Where can I see the list when I do the command ":n files"? What are the commands ":prev" and ":n" supposed to do? I got the error message: > There is only one file to edit.
file
vim
null
null
null
null
open
Accessing Multiple Files in VIM === The book "Unix in a Nutshell" discusses about accessing multiple files on pages 572-573. There seem to be very useful commands such as ":e", ":e #", ":e new_file", ":n files", ":args", ":prev" and ":n!". The commands confuse me: > ":n Edit next file in the list of files." > ":args Display list of files to be edited." > ":prev Edit previous file in the list of files." I cannot see no real list when I do ":args". There is only a small text at the corner. I would like to see all files that I accessed with ":e", ie a list of files in the buffer. Where can I see the list when I do the command ":n files"? What are the commands ":prev" and ":n" supposed to do? I got the error message: > There is only one file to edit.
0
4,521,667
12/23/2010 19:02:57
544,562
12/16/2010 09:46:29
1
0
Hide elements using jquery based on option select
I have two forms and a selector. This is my code -- <select> <option value="1">Pay</option> <option value="2">Goog</option> </select> <form id="pp"> <input type="text"> </form> <form id="cc"> <input type="text"> </form> Now if option 1 is selected i want to hide form CC. if 2 hide form PP. How do i do it with js or jquery? thanks
javascript
jquery
forms
null
null
null
open
Hide elements using jquery based on option select === I have two forms and a selector. This is my code -- <select> <option value="1">Pay</option> <option value="2">Goog</option> </select> <form id="pp"> <input type="text"> </form> <form id="cc"> <input type="text"> </form> Now if option 1 is selected i want to hide form CC. if 2 hide form PP. How do i do it with js or jquery? thanks
0
8,526,626
12/15/2011 21:10:02
1,096,892
10/12/2011 19:29:32
391
1
More buttons are selected than the limit
Please follow these steps in the jsfiddle to understand my question 1. Click on open grid link and select option "3", buttons A,B and C would appear 2. Enter in number 2 in the number of Answers textbox. Then select buttons A and C 3. Now click on the open grid again and select option 6. 4. Now the number of Answers textbox is empty so type in 2 again in the text-box. So only 2 answers should be selected and as A and C is already selected, it should not allow another button to be selected (an alert should appear) But this does not happen. Instead the user can select another 2 buttons and then the alert message would appear if another button is selected. This means you see 4 buttons being selected which is incorrect, it should still be 2. So does anyone have an idea why it is doing this? Thanks Code is in jsfiddle, click [here][1] [1]: http://jsfiddle.net/C7vcQ/2/
jquery
null
null
null
null
01/06/2012 02:17:05
not a real question
More buttons are selected than the limit === Please follow these steps in the jsfiddle to understand my question 1. Click on open grid link and select option "3", buttons A,B and C would appear 2. Enter in number 2 in the number of Answers textbox. Then select buttons A and C 3. Now click on the open grid again and select option 6. 4. Now the number of Answers textbox is empty so type in 2 again in the text-box. So only 2 answers should be selected and as A and C is already selected, it should not allow another button to be selected (an alert should appear) But this does not happen. Instead the user can select another 2 buttons and then the alert message would appear if another button is selected. This means you see 4 buttons being selected which is incorrect, it should still be 2. So does anyone have an idea why it is doing this? Thanks Code is in jsfiddle, click [here][1] [1]: http://jsfiddle.net/C7vcQ/2/
1
194,094
10/11/2008 13:58:58
4,653
09/05/2008 00:53:33
203
4
Model - View - Presenter with Virtual Grid
What is the best breakdown of responsibility when using a virtual grid and the MVP pattern in a winforms application. including: 1. Getting callbacks from the grid on user changed cell updates 2. Callback from the grid to set the style and value of a cell given a row and column
c#
mvp
winforms
virtual
grid
null
open
Model - View - Presenter with Virtual Grid === What is the best breakdown of responsibility when using a virtual grid and the MVP pattern in a winforms application. including: 1. Getting callbacks from the grid on user changed cell updates 2. Callback from the grid to set the style and value of a cell given a row and column
0
7,139,429
08/21/2011 16:12:37
648,138
03/07/2011 12:27:30
1,606
41
Books on computer architecture that covers these topics
I am looking for a book on computer architecture that starts from a basic level and goes in depth . I had searched some books like: [Structured computer organization by Andrew S. Tanenbaum ][1] but i also found negative reviews about this book. I am looking for a **very good** book that teaches : <ul> <li>***Principles of xomputer design - software/ hardware interaction , cost/benifit concept of layers in architecture design <li>Basic computer organization taking 8085 as an example binary arithmetic - add,subtract,multiply-algorithms and implementations. `carry look ahead add fast adders`. <li>CPU design - Choice of instruction set control structure hardwired and microprogrammed control- RISC v/s CISC , pipelining in CPU design superscalar machines <li> Memory hierarchy design caches,main memory,Interleave memory virtual memory architectural aids in implementing these. <li> I/O Modes - program interrupt , DMA , channel , I/O Processer <li> I/O performance measures - Buses connecting I/O devices to CPU memory - interaction with OS serial/parallel interfaces taking 8251 and 8255 as examples <li> Performance evaluation SPEC marks LINPACK whetstone Dhrystone etc., Transaction processing Benchmarks <li>Multiprocessers - Parallel & distributed computers - SIMD SPMD and MIMD machines </ul>*** [1]: http://books.google.com/books?id=WG5gQgAACAAJ&dq=inauthor:%22Andrew%20S.%20Tanenbaum%22&hl=en&ei=lSVRTtmmDI3prQf_ndWsAg&sa=X&oi=book_result&ct=result&resnum=6&ved=0CEYQ6AEwBQ
books
computer-science
computer-architecture
null
null
08/21/2011 16:28:09
not constructive
Books on computer architecture that covers these topics === I am looking for a book on computer architecture that starts from a basic level and goes in depth . I had searched some books like: [Structured computer organization by Andrew S. Tanenbaum ][1] but i also found negative reviews about this book. I am looking for a **very good** book that teaches : <ul> <li>***Principles of xomputer design - software/ hardware interaction , cost/benifit concept of layers in architecture design <li>Basic computer organization taking 8085 as an example binary arithmetic - add,subtract,multiply-algorithms and implementations. `carry look ahead add fast adders`. <li>CPU design - Choice of instruction set control structure hardwired and microprogrammed control- RISC v/s CISC , pipelining in CPU design superscalar machines <li> Memory hierarchy design caches,main memory,Interleave memory virtual memory architectural aids in implementing these. <li> I/O Modes - program interrupt , DMA , channel , I/O Processer <li> I/O performance measures - Buses connecting I/O devices to CPU memory - interaction with OS serial/parallel interfaces taking 8251 and 8255 as examples <li> Performance evaluation SPEC marks LINPACK whetstone Dhrystone etc., Transaction processing Benchmarks <li>Multiprocessers - Parallel & distributed computers - SIMD SPMD and MIMD machines </ul>*** [1]: http://books.google.com/books?id=WG5gQgAACAAJ&dq=inauthor:%22Andrew%20S.%20Tanenbaum%22&hl=en&ei=lSVRTtmmDI3prQf_ndWsAg&sa=X&oi=book_result&ct=result&resnum=6&ved=0CEYQ6AEwBQ
4
9,677,593
03/13/2012 02:27:00
1,256,334
03/08/2012 05:58:19
1
0
Forwarding 150 emails from gmail account to another gmail account
I ve got like 150 email and have to send all to another account,Is there anyway to do it at once?
gmail
null
null
null
null
03/13/2012 10:41:13
off topic
Forwarding 150 emails from gmail account to another gmail account === I ve got like 150 email and have to send all to another account,Is there anyway to do it at once?
2
8,087,836
11/10/2011 23:24:45
167,958
09/03/2009 15:14:48
14,835
472
Is the order of file-level static variables always the same within a given translation unit?
I have a program split up into two source files: _example.cpp_ #include <iostream> class A { public: A(int x) { ::std::cout << "In A(" << x << ")\n"; } }; static A first(1); static A second(2); _example_main.cpp_ int main(int argc, const char *argv[]) { return 0; } Is the output of this program guaranteed to be: In A(1) In A(2) on all platforms and compilers? If so, where in the standard does it say this? Does it matter if I'm using namespaces and `first` and `second` appear in different namespaces? How about if they aren't static and I'm using an anonymous namespace?
c++
initialization
static-initialization
static-order-fiasco
null
null
open
Is the order of file-level static variables always the same within a given translation unit? === I have a program split up into two source files: _example.cpp_ #include <iostream> class A { public: A(int x) { ::std::cout << "In A(" << x << ")\n"; } }; static A first(1); static A second(2); _example_main.cpp_ int main(int argc, const char *argv[]) { return 0; } Is the output of this program guaranteed to be: In A(1) In A(2) on all platforms and compilers? If so, where in the standard does it say this? Does it matter if I'm using namespaces and `first` and `second` appear in different namespaces? How about if they aren't static and I'm using an anonymous namespace?
0
8,149,821
11/16/2011 10:07:05
1,150,619
06/29/2011 07:43:03
1,235
111
Place elements randomly into document background?
I try to create a plugin for personal use, that will place clouds in my web page randomly. Lets see now what is my idea: I have create an image with all my clouds. In my CSS I have create a general class called .cloud that is applyed to all cloud elements and four classes .cloud_1 .cloud_2 .cloud_3 .cloud_4 for each cloud element I like to place in my document. Here are the css classes I use: .cloud { display: block; position: absolute; background: transparent url(../img/clouds.png) no-repeat 0px 0px; } .cloud_1 { width: 800px; height: 350px; background-position: 0px 0px; z-index: 1; } .cloud_2 { width: 800px; height: 469px; background-position: 0px -350px; z-index: 2; } .cloud_3 { width: 800px; height: 405px; background-position: 0px -819px; z-index: 3; } .cloud_4 { width: 630px; height: 314px; background-position: 0px -1225px; z-index: 4; } From the other hand I use jQuery to place generate and place my clouds randomly into my document with random top and left. The problem I have is that, if I set the position to absolute for .cloud selector the clouds that go out of the document width they activating the horizontal scroll bar. If I set it to fixed, the clouds are attached to the same position while I scroll down and so on. What is the best solution in order to place my clouds with no horizontal scroll bar and not stay fixed in the same position ?
jquery
css
null
null
null
null
open
Place elements randomly into document background? === I try to create a plugin for personal use, that will place clouds in my web page randomly. Lets see now what is my idea: I have create an image with all my clouds. In my CSS I have create a general class called .cloud that is applyed to all cloud elements and four classes .cloud_1 .cloud_2 .cloud_3 .cloud_4 for each cloud element I like to place in my document. Here are the css classes I use: .cloud { display: block; position: absolute; background: transparent url(../img/clouds.png) no-repeat 0px 0px; } .cloud_1 { width: 800px; height: 350px; background-position: 0px 0px; z-index: 1; } .cloud_2 { width: 800px; height: 469px; background-position: 0px -350px; z-index: 2; } .cloud_3 { width: 800px; height: 405px; background-position: 0px -819px; z-index: 3; } .cloud_4 { width: 630px; height: 314px; background-position: 0px -1225px; z-index: 4; } From the other hand I use jQuery to place generate and place my clouds randomly into my document with random top and left. The problem I have is that, if I set the position to absolute for .cloud selector the clouds that go out of the document width they activating the horizontal scroll bar. If I set it to fixed, the clouds are attached to the same position while I scroll down and so on. What is the best solution in order to place my clouds with no horizontal scroll bar and not stay fixed in the same position ?
0
4,206,500
11/17/2010 16:14:31
510,858
11/17/2010 13:57:54
3
0
How to get the row number of ID of a sql table?
suppose i need to print the 3rd, 5th, 9th, 20th, 34th and so on...
php
null
null
null
null
11/17/2010 19:06:01
not a real question
How to get the row number of ID of a sql table? === suppose i need to print the 3rd, 5th, 9th, 20th, 34th and so on...
1
11,271,880
06/30/2012 06:04:45
394,788
07/17/2010 18:15:20
10
0
Can I charge for an iOS app that uses Foursquare data?
I couldn't find anything in the docs that permitted or restricted this so I wanted to check so I knew it advance.
ios
null
null
null
null
06/30/2012 10:20:49
off topic
Can I charge for an iOS app that uses Foursquare data? === I couldn't find anything in the docs that permitted or restricted this so I wanted to check so I knew it advance.
2
8,185,217
11/18/2011 15:59:48
1,043,353
11/12/2011 17:12:42
101
0
Summing XML attributes sometimes returns zero C#
I'm trying to parse an NZB file (which is XML) and sum the bytes attributes. Sometimes it works perfectly and sometimes it returns zero, and I can't figure out why. The NZB files have identical structure as far as I can tell. private Int32 processNZB(string sFilename) { XDocument xFile = XDocument.Load(sFilename); Int32 sum = xFile.Descendants("segment").Sum(x => (int)x.Attribute("bytes")); sum = (int)(sum / 1024 / 1024); // bytes -> MB return sum; } Source code and sample files can be found here: http://jonathanslaven.com/.for/.stackoverflow/ Is there an obvious reason this isn't working? Is there a better way of doing this? Thanks for your help.
c#
xml
.net-3.5
xdocument
null
null
open
Summing XML attributes sometimes returns zero C# === I'm trying to parse an NZB file (which is XML) and sum the bytes attributes. Sometimes it works perfectly and sometimes it returns zero, and I can't figure out why. The NZB files have identical structure as far as I can tell. private Int32 processNZB(string sFilename) { XDocument xFile = XDocument.Load(sFilename); Int32 sum = xFile.Descendants("segment").Sum(x => (int)x.Attribute("bytes")); sum = (int)(sum / 1024 / 1024); // bytes -> MB return sum; } Source code and sample files can be found here: http://jonathanslaven.com/.for/.stackoverflow/ Is there an obvious reason this isn't working? Is there a better way of doing this? Thanks for your help.
0
6,629,869
07/08/2011 20:04:09
167,726
09/03/2009 08:27:38
441
10
Any ASP.NET MVC sample using DI, AOP, POCO, UoW, Mocks, and Unit Tests
Can somebody point me to a ASP.NET MVC 2 sample with following features (most of them): - Dependency Inversion using any DI framework - Repository pattern & Unit of Work pattern - Entity Framework 4.1 and POCO (or NHibernate) - Unit Testing using any framework - Mocking using any mocking framework - Data Annotations, Validations - ViewModel and AutoMapper - AJAX - jQuery for Client side validations & UI - With some cross-cutting concerns like logging addressed using AOP
asp.net-mvc-2
code-sample
null
null
null
null
open
Any ASP.NET MVC sample using DI, AOP, POCO, UoW, Mocks, and Unit Tests === Can somebody point me to a ASP.NET MVC 2 sample with following features (most of them): - Dependency Inversion using any DI framework - Repository pattern & Unit of Work pattern - Entity Framework 4.1 and POCO (or NHibernate) - Unit Testing using any framework - Mocking using any mocking framework - Data Annotations, Validations - ViewModel and AutoMapper - AJAX - jQuery for Client side validations & UI - With some cross-cutting concerns like logging addressed using AOP
0
11,312,548
07/03/2012 13:58:21
606,901
02/07/2011 18:16:43
74
8
How quick is mongodb replication?
I apologize for such a generic question. I am trying to see if MongoDB satisfies our project need. We have a requirement for some data needs to be made available(read-only) on multiple machines. Was wondering if we could leverage mongoDB replication sets for this purpose wherein the data is written on one machine and is distributed out to all the machines within a certain time. Data to be replicated is limited to 2-3 MB and there are around 200 - 250 machines to replicate. Thanks.
mongodb
replication
null
null
null
07/05/2012 14:27:44
off topic
How quick is mongodb replication? === I apologize for such a generic question. I am trying to see if MongoDB satisfies our project need. We have a requirement for some data needs to be made available(read-only) on multiple machines. Was wondering if we could leverage mongoDB replication sets for this purpose wherein the data is written on one machine and is distributed out to all the machines within a certain time. Data to be replicated is limited to 2-3 MB and there are around 200 - 250 machines to replicate. Thanks.
2
9,843,149
03/23/2012 16:45:46
1,280,767
03/20/2012 11:35:56
1
1
Detecting PixelType / ColourDepth in TwainDotNet
I'm using TwainDotNet to scan images. When the TransferImage event fires I'd like to know the current PixelType / ColourDepth from the TwainSource so I am able to compress the image according to it's type. I've tried looking at the Image returned in TransferImageEventArgs but this always seems to be ARGB. I'm a newbie at TwainDotNet so please excuse the noob question :) Thanks!
c#
wpf
twain
null
null
null
open
Detecting PixelType / ColourDepth in TwainDotNet === I'm using TwainDotNet to scan images. When the TransferImage event fires I'd like to know the current PixelType / ColourDepth from the TwainSource so I am able to compress the image according to it's type. I've tried looking at the Image returned in TransferImageEventArgs but this always seems to be ARGB. I'm a newbie at TwainDotNet so please excuse the noob question :) Thanks!
0
242,517
10/28/2008 07:59:00
30,884
10/23/2008 16:59:40
1
1
Extremely Wierd Bug with a property in C#
I have a certain application which feeds information into an object, after comparing the new information to the old information. It goes something like set { oldval=_value; _value=value; if (some comparison logic) raiseEvent(); } This all happens on a background thread, in an infinite loop, which intermittently sleeps for 100ms. The really odd part is that it works the first time, the comparison logic turns up true, and the event is raised. After that, the information keeps flowing, it keep entering the object, I know this because I set MessageBoxes to display the old and new values all the time, but its as if it somehow bypasses the set clause! I set a messagebox in the beginning of the clause, an it just doesn't pop up! This is really wierd, since I am sure that the value keeps updating. Any Thoughts?
c#
.net
property
null
null
01/24/2012 08:42:57
too localized
Extremely Wierd Bug with a property in C# === I have a certain application which feeds information into an object, after comparing the new information to the old information. It goes something like set { oldval=_value; _value=value; if (some comparison logic) raiseEvent(); } This all happens on a background thread, in an infinite loop, which intermittently sleeps for 100ms. The really odd part is that it works the first time, the comparison logic turns up true, and the event is raised. After that, the information keeps flowing, it keep entering the object, I know this because I set MessageBoxes to display the old and new values all the time, but its as if it somehow bypasses the set clause! I set a messagebox in the beginning of the clause, an it just doesn't pop up! This is really wierd, since I am sure that the value keeps updating. Any Thoughts?
3
1,853,737
12/05/2009 22:50:04
225,576
12/05/2009 22:50:04
1
0
importing c++ data types to haskell with ffi
I'm writing a haskell wrapper for a c++ library and as much as I can import functions from the library to my haskell program, I have no clue how to import c++ data types. For instance I have a function which takes as a parameter a video::E_DRIVER_TYPE EDT_OPENGL type defined in some.h file, and as I said before I know how to import the function with ffi using foreign import ccall ... with the appropriate compiler-mangled function name but I'm not able to call the function from haskell because I can't figure out how to import/use this specific video driver data type. Now, I know that you can create types in Haskell but still I need a starting point as to what to define the type to whatever the c++ representation is. (I'm confused at this point) I would appreciate any kind of help! Thanks
haskell
c++
types
ffi
null
null
open
importing c++ data types to haskell with ffi === I'm writing a haskell wrapper for a c++ library and as much as I can import functions from the library to my haskell program, I have no clue how to import c++ data types. For instance I have a function which takes as a parameter a video::E_DRIVER_TYPE EDT_OPENGL type defined in some.h file, and as I said before I know how to import the function with ffi using foreign import ccall ... with the appropriate compiler-mangled function name but I'm not able to call the function from haskell because I can't figure out how to import/use this specific video driver data type. Now, I know that you can create types in Haskell but still I need a starting point as to what to define the type to whatever the c++ representation is. (I'm confused at this point) I would appreciate any kind of help! Thanks
0
9,423,892
02/24/2012 01:00:38
496,969
11/04/2010 09:01:56
103
11
How to rotate a flat object around its center in perspective view?
What I'm trying to do seems like it should be easy enough: I created a 2D top-down view of an old phonograph record. I want to rotate it (lay it back) in its X axis and then spin it around its Z axis. I've read every question here that has CATransform3D in the body, I've read Steve Baker's ["Matrices can be your friends"][1] article as well as Bill Dudney's book "Core Animation for Mac OS X and the iPhone" I think Brad Larson's ["3-D Rotation without a trackball"][2] has all the right code, but since he's permitting the user to adjust all three axis, I'm having a hard time shrinking his code into what I perceive to be just one dimension (a rotated z axis). Here's the image I'm testing with, not that the particulars are important to the problem: ![Gold Record][3] I bring that onscreen the usual way: (in a subclass of UIView) - (void)awakeFromNib { UIImage *recordImage = [UIImage imageNamed:@"3DgoldRecord"]; if (recordImage) { recordLayer = [CALayer layer]; [recordLayer setFrame:CGRectMake(0.0, 0.0, 1024, 1024)]; [recordLayer setContents:(id)[[UIImage imageNamed:@"3DgoldRecord"] CGImage]]; [self.layer addSublayer:recordLayer]; } } That's the first test, just getting it on the screen ;-) Then, to "lay it back" I apply a transform to rotate about the layer's X axis, inserting this code after setting the contents of the layer to the image and before adding the sublayer: CATransform3D myRotationTransform = CATransform3DRotate(recordLayer.transform, (M_PI_2 * 0.85), //experiment with flatness 1.0, // rotate only across the x-axis 0.0, // no y-axis transform 0.0); // no z-axis transform recordLayer.transform = myRotationTransform; That worked as expected: The record is laying back nicely. And for the next step, causing the record to spin, I tied this animation to the touchesEnded event, although once out of the testing/learning phase this rotation won't be under user control: CATransform3D currentTransform = recordLayer.transform; // to come back to at the end CATransform3D myRotationTransform = CATransform3DRotate(currentTransform, 1.0, // go all the way around once (M_PI_2 * 0.85), // x-axis change 1.00, // y-axis change ? 0.0); // z-axis change ? recordLayer.transform = myRotationTransform; CABasicAnimation *myAnimation = [CABasicAnimation animationWithKeyPath:@"transform.rotation"]; myAnimation.duration = 5.0; myAnimation.fromValue = [NSNumber numberWithFloat:0.0]; myAnimation.toValue = [NSNumber numberWithFloat:M_PI * 2.0]; myAnimation.delegate = self; [recordLayer addAnimation:myAnimation forKey:@"transform.rotation"]; So I'm pretty sure what I'm hung up on is the vector in the CATransform3DRotate call (trust me: I've been trying simple changes in that vector to watch the change... what's listed there now is simply the last change I tried). As I understand it, the values for x, y, and z in the transform are, in essence, the percentage of the value passed in during the animation ranging from fromValue to toValue. If I'm on the right track understanding this, is it possible to express this in a single transform? Or must I, for each effective frame of animation, rotate the original upright image slightly around the z axis and then lay the result down with an x axis rotation? I saw a question/answer that talked about combining transforms, but that was a scale transform followed by a rotation transform. I have messed around with transforming the transform, but isn't doing what I think I should be getting (i.e. passing the result of one transform into the transform argument of the next seemed to just execute one completely and then animate the other). [1]: http://www.sjbaker.org/steve/omniv/matrices_can_be_your_friends.html [2]: http://www.sunsetlakesoftware.com/2008/10/22/3-d-rotation-without-trackball [3]: http://i.stack.imgur.com/EXhku.png
ios
catransform3d
null
null
null
null
open
How to rotate a flat object around its center in perspective view? === What I'm trying to do seems like it should be easy enough: I created a 2D top-down view of an old phonograph record. I want to rotate it (lay it back) in its X axis and then spin it around its Z axis. I've read every question here that has CATransform3D in the body, I've read Steve Baker's ["Matrices can be your friends"][1] article as well as Bill Dudney's book "Core Animation for Mac OS X and the iPhone" I think Brad Larson's ["3-D Rotation without a trackball"][2] has all the right code, but since he's permitting the user to adjust all three axis, I'm having a hard time shrinking his code into what I perceive to be just one dimension (a rotated z axis). Here's the image I'm testing with, not that the particulars are important to the problem: ![Gold Record][3] I bring that onscreen the usual way: (in a subclass of UIView) - (void)awakeFromNib { UIImage *recordImage = [UIImage imageNamed:@"3DgoldRecord"]; if (recordImage) { recordLayer = [CALayer layer]; [recordLayer setFrame:CGRectMake(0.0, 0.0, 1024, 1024)]; [recordLayer setContents:(id)[[UIImage imageNamed:@"3DgoldRecord"] CGImage]]; [self.layer addSublayer:recordLayer]; } } That's the first test, just getting it on the screen ;-) Then, to "lay it back" I apply a transform to rotate about the layer's X axis, inserting this code after setting the contents of the layer to the image and before adding the sublayer: CATransform3D myRotationTransform = CATransform3DRotate(recordLayer.transform, (M_PI_2 * 0.85), //experiment with flatness 1.0, // rotate only across the x-axis 0.0, // no y-axis transform 0.0); // no z-axis transform recordLayer.transform = myRotationTransform; That worked as expected: The record is laying back nicely. And for the next step, causing the record to spin, I tied this animation to the touchesEnded event, although once out of the testing/learning phase this rotation won't be under user control: CATransform3D currentTransform = recordLayer.transform; // to come back to at the end CATransform3D myRotationTransform = CATransform3DRotate(currentTransform, 1.0, // go all the way around once (M_PI_2 * 0.85), // x-axis change 1.00, // y-axis change ? 0.0); // z-axis change ? recordLayer.transform = myRotationTransform; CABasicAnimation *myAnimation = [CABasicAnimation animationWithKeyPath:@"transform.rotation"]; myAnimation.duration = 5.0; myAnimation.fromValue = [NSNumber numberWithFloat:0.0]; myAnimation.toValue = [NSNumber numberWithFloat:M_PI * 2.0]; myAnimation.delegate = self; [recordLayer addAnimation:myAnimation forKey:@"transform.rotation"]; So I'm pretty sure what I'm hung up on is the vector in the CATransform3DRotate call (trust me: I've been trying simple changes in that vector to watch the change... what's listed there now is simply the last change I tried). As I understand it, the values for x, y, and z in the transform are, in essence, the percentage of the value passed in during the animation ranging from fromValue to toValue. If I'm on the right track understanding this, is it possible to express this in a single transform? Or must I, for each effective frame of animation, rotate the original upright image slightly around the z axis and then lay the result down with an x axis rotation? I saw a question/answer that talked about combining transforms, but that was a scale transform followed by a rotation transform. I have messed around with transforming the transform, but isn't doing what I think I should be getting (i.e. passing the result of one transform into the transform argument of the next seemed to just execute one completely and then animate the other). [1]: http://www.sjbaker.org/steve/omniv/matrices_can_be_your_friends.html [2]: http://www.sunsetlakesoftware.com/2008/10/22/3-d-rotation-without-trackball [3]: http://i.stack.imgur.com/EXhku.png
0
11,334,018
07/04/2012 18:34:22
1,502,264
07/04/2012 18:28:13
1
0
MsSql Query slow when paginated
I am seeing some strange behaviour with following SQL Query: (SQL Server 2012) select * FROM dbo.Person WHERE CONTAINS(Name, '"John" AND "Smith"') order by Name Executing this query alone gives me about 1'300 results in less than two seconds. (There's a fulltext-index on Name) When I, however, change the query to the following: select * FROM dbo.Person WHERE CONTAINS(Name, '"John" AND "Smith"') order by Name offset 0 rows fetch next 10 ROWS ONLY It takes more than 20 seconds to give me 10 results. Following Query is even worse: SELECT Id FROM ( SELECT ROW_NUMBER() OVER (ORDER BY Name) AS RowNum, * FROM dbo.Person WHERE CONTAINS(Name, '"John" AND "Smith"') ) AS RowConstrainedResult WHERE RowNum >= 0 AND RowNum < 11 ORDER BY RowNum It takes more than 1.5 minutes to complete! Any ideas?
sql
sql-server
null
null
null
07/10/2012 16:25:37
off topic
MsSql Query slow when paginated === I am seeing some strange behaviour with following SQL Query: (SQL Server 2012) select * FROM dbo.Person WHERE CONTAINS(Name, '"John" AND "Smith"') order by Name Executing this query alone gives me about 1'300 results in less than two seconds. (There's a fulltext-index on Name) When I, however, change the query to the following: select * FROM dbo.Person WHERE CONTAINS(Name, '"John" AND "Smith"') order by Name offset 0 rows fetch next 10 ROWS ONLY It takes more than 20 seconds to give me 10 results. Following Query is even worse: SELECT Id FROM ( SELECT ROW_NUMBER() OVER (ORDER BY Name) AS RowNum, * FROM dbo.Person WHERE CONTAINS(Name, '"John" AND "Smith"') ) AS RowConstrainedResult WHERE RowNum >= 0 AND RowNum < 11 ORDER BY RowNum It takes more than 1.5 minutes to complete! Any ideas?
2
6,646,685
07/11/2011 06:53:26
834,862
07/08/2011 06:33:22
1
0
solve y cube equation in runtime.
I am doing cropping a object in real time using c++. Here I know 2 coordinates of points A and B. I want to find 3rd point Z which is perpendicular to AB line. Z(x3,y3). It mean ABZ angle is 90. I gained 2 huge equations when I have used BZ slope and BZ distance. I have simplified it and gain following equation. `y3 ( y3 (k1 + y3) + k) = k ;` here k1 , k2 , k3 are Constance which has given. But `k1 , k2 , k3` are not equals to each other. I want to find y3 here. Please help me.
c++
algorithm
math
null
null
07/11/2011 09:52:27
off topic
solve y cube equation in runtime. === I am doing cropping a object in real time using c++. Here I know 2 coordinates of points A and B. I want to find 3rd point Z which is perpendicular to AB line. Z(x3,y3). It mean ABZ angle is 90. I gained 2 huge equations when I have used BZ slope and BZ distance. I have simplified it and gain following equation. `y3 ( y3 (k1 + y3) + k) = k ;` here k1 , k2 , k3 are Constance which has given. But `k1 , k2 , k3` are not equals to each other. I want to find y3 here. Please help me.
2
11,368,394
07/06/2012 19:17:15
1,411,745
05/23/2012 05:23:05
6
1
Make a game server using UDK
I'm new in udk, and I just wanted to ask, that how can I do a online game server for my udk game, becouse I have no idea about that. Thank you for your answers.
unreal-development-kit
unrealscript
server
null
null
07/08/2012 09:17:20
not a real question
Make a game server using UDK === I'm new in udk, and I just wanted to ask, that how can I do a online game server for my udk game, becouse I have no idea about that. Thank you for your answers.
1
3,689,645
09/11/2010 03:08:35
1,246,275
08/20/2010 14:46:33
441
29
Random word selection
Is there a way to get a **random word from an online dictionary** like dictionary.com, into a string for use in **PHP**. **API's** etc... **Impossible or not?**
php
string
api
dictionary
words
09/13/2010 01:24:29
not a real question
Random word selection === Is there a way to get a **random word from an online dictionary** like dictionary.com, into a string for use in **PHP**. **API's** etc... **Impossible or not?**
1
8,000,579
11/03/2011 19:15:54
1,026,753
11/02/2011 23:57:31
1
0
Firebug shows my js files in the net panel for a split second then they vanish
I'm trying to evaluate my js load times, but Firebug won't show them to me. I go to the net panel, load the page, and I can see my 10 or 12 js files for a split second, but then they vanish and are replaced by Google Analytic's script as the only one that shows up at the end.. what gives?
javascript
firebug
null
null
null
null
open
Firebug shows my js files in the net panel for a split second then they vanish === I'm trying to evaluate my js load times, but Firebug won't show them to me. I go to the net panel, load the page, and I can see my 10 or 12 js files for a split second, but then they vanish and are replaced by Google Analytic's script as the only one that shows up at the end.. what gives?
0
1,339,121
08/27/2009 06:07:14
65,387
02/12/2009 03:01:00
1,444
83
How to reverse a QList?
I see [qCopy][1], and [qCopybackward][2] but neither seems to let me make a copy in reverse order. `qCopybackward` only copies it in reverse order, but keeps the darn elements in the same order! All I want to do is return a copy of the list in reverse order. There **has** to be a function for that, right? [1]: http://doc.trolltech.com/4.5/qtalgorithms.html#qCopy [2]: http://doc.trolltech.com/4.5/qtalgorithms.html#qCopyBackward
qt
null
null
null
null
null
open
How to reverse a QList? === I see [qCopy][1], and [qCopybackward][2] but neither seems to let me make a copy in reverse order. `qCopybackward` only copies it in reverse order, but keeps the darn elements in the same order! All I want to do is return a copy of the list in reverse order. There **has** to be a function for that, right? [1]: http://doc.trolltech.com/4.5/qtalgorithms.html#qCopy [2]: http://doc.trolltech.com/4.5/qtalgorithms.html#qCopyBackward
0
8,374,106
12/04/2011 08:16:33
1,079,854
12/04/2011 07:55:42
1
0
Get data from a textbox in Urdu or any reginal language in C#
Not read data in the language that i typed. But take the English characters that I typed. Hello I want to insert data from text-box to SQLdatabase in Urdu language. I applied all settings that is required for Urdu text. When I write the text into the text-box it displays in Urdu but when i insert data after reading the data from text-box it display in English and also same English data in database. Yes ! when I copy the Urdu data from any where else and paste it on the text-box and insert this to the database then it is in Urdu. Now I want to send data into database as it is displayed on the text-box in Urdu. Problem is created when i typed the text to text-box. Please help me in c# language or any code of c# that solve my issue. I an using windows 7 and Visual Studio 2008.
c#-4.0
null
null
null
null
12/04/2011 15:28:24
not a real question
Get data from a textbox in Urdu or any reginal language in C# === Not read data in the language that i typed. But take the English characters that I typed. Hello I want to insert data from text-box to SQLdatabase in Urdu language. I applied all settings that is required for Urdu text. When I write the text into the text-box it displays in Urdu but when i insert data after reading the data from text-box it display in English and also same English data in database. Yes ! when I copy the Urdu data from any where else and paste it on the text-box and insert this to the database then it is in Urdu. Now I want to send data into database as it is displayed on the text-box in Urdu. Problem is created when i typed the text to text-box. Please help me in c# language or any code of c# that solve my issue. I an using windows 7 and Visual Studio 2008.
1
3,424,000
08/06/2010 13:05:15
392,502
07/15/2010 09:14:16
19
0
i need to verify a zope tree with a selenium right click
I'm testing a tree made in zope that needs to be clicked with right_click, i know that the command for left click with selenium in python is selenium.click ,but i don't know any for right_click ,can anyone help me please.
python
selenium
zope
right-click
null
null
open
i need to verify a zope tree with a selenium right click === I'm testing a tree made in zope that needs to be clicked with right_click, i know that the command for left click with selenium in python is selenium.click ,but i don't know any for right_click ,can anyone help me please.
0
3,647,183
09/05/2010 18:16:20
440,137
09/05/2010 18:16:20
1
0
Search database for offensive words
I am looking on running a search on my database at set intervals for a list of words I consider offensive (because I am an authoritarian dictator and I hate free speech - I rule with an Iron fist). How would I most efficiently search my database for a list of keywords? The two columns I intend to search are indexed as Fulltext. If anyone knows of a list of offensive words that would be useful too.
php
mysql
censorship
null
null
null
open
Search database for offensive words === I am looking on running a search on my database at set intervals for a list of words I consider offensive (because I am an authoritarian dictator and I hate free speech - I rule with an Iron fist). How would I most efficiently search my database for a list of keywords? The two columns I intend to search are indexed as Fulltext. If anyone knows of a list of offensive words that would be useful too.
0
6,067,868
05/20/2011 05:38:30
584,020
01/21/2011 05:52:28
6
0
Can anyone please let me know how to implement the differential timer concept
Can anyone please let me know how to implement the differential timer concept. I am working on a mobile platform, which gives or upports only one hardware timer. Using this i have to maintain different timers requested by application. Can anyone please suggest a best approach to implement this software timers using one hardware timer
c
timer
null
null
null
05/20/2011 11:18:41
not a real question
Can anyone please let me know how to implement the differential timer concept === Can anyone please let me know how to implement the differential timer concept. I am working on a mobile platform, which gives or upports only one hardware timer. Using this i have to maintain different timers requested by application. Can anyone please suggest a best approach to implement this software timers using one hardware timer
1
5,326,434
03/16/2011 14:03:58
662,624
03/16/2011 14:03:58
1
0
Amazon EC2 with Windows 2008 R2
A new Windows 2k8 R2 image is now available on Amazon. I have two questions about this: 1. It doesn't appear that 32-bit (Small) images are available. Is this correct? 2. From a programmatic point of view, what advantages will R2 give me over the standard Windows image?
windows-server-2008
amazon-ec2
amazon-web-services
null
null
03/17/2011 14:06:45
off topic
Amazon EC2 with Windows 2008 R2 === A new Windows 2k8 R2 image is now available on Amazon. I have two questions about this: 1. It doesn't appear that 32-bit (Small) images are available. Is this correct? 2. From a programmatic point of view, what advantages will R2 give me over the standard Windows image?
2
8,735,990
01/05/2012 00:16:07
10,272
09/15/2008 22:04:03
1,332
17
What are some best practices for continuous deployment / iterative development / AB testing of mobile apps?
Between native apps that go through app-store review process (android non-review), and web apps that just live in browsers, through hybrid apps that utilize phonegap or other home made UIWebView support, what are industry's best practices to minimize deployment time a-la continuous deployment while still maintaining the goodness and features of native mobile apps? (push etc) My app is in the store but every time I update a version it takes a few days for apple to approve. This is of course normal, but painful. Not only that, but even worse, even after the app is on the store, not all users install the new version immediately (or ever). This leaves a very long tail of backwards compatibility support behind and a huge headache... How am I supposed to iterate fast, perhaps perform AB testing, when first, it takes about a week for apple to approve a new version and second I have to maintain backwards compatibility virtually forever? Coming from a web shop where I implemented continuous deployment, where we used to deploy dozens of times every day, this is very frustrating... What are industry's best practices to beat the current marketplaces inherent slowness so we could to iterate faster, experiment and not have to deal with such a long tail of back-compat support? Requirements wise, the app needs to: - Run on iOS, Android, perhaps later on other devices - Access a few of the local resources, such as address book, push notifications - Store data locally (currently I use Core Data) - Well.. look good, perform animations, not be clunky, feel right... This section is negotiable and it's hard to quantify it but users will know when I bargin too low... Please note that the same (or very similar) question was also asked on Quora but was left unanswered, so maybe SO is better home for it... http://www.quora.com/What-are-the-best-practices-for-continuous-deployment-of-mobile-apps
android
ios
continuous-deployment
null
null
06/20/2012 12:08:26
not constructive
What are some best practices for continuous deployment / iterative development / AB testing of mobile apps? === Between native apps that go through app-store review process (android non-review), and web apps that just live in browsers, through hybrid apps that utilize phonegap or other home made UIWebView support, what are industry's best practices to minimize deployment time a-la continuous deployment while still maintaining the goodness and features of native mobile apps? (push etc) My app is in the store but every time I update a version it takes a few days for apple to approve. This is of course normal, but painful. Not only that, but even worse, even after the app is on the store, not all users install the new version immediately (or ever). This leaves a very long tail of backwards compatibility support behind and a huge headache... How am I supposed to iterate fast, perhaps perform AB testing, when first, it takes about a week for apple to approve a new version and second I have to maintain backwards compatibility virtually forever? Coming from a web shop where I implemented continuous deployment, where we used to deploy dozens of times every day, this is very frustrating... What are industry's best practices to beat the current marketplaces inherent slowness so we could to iterate faster, experiment and not have to deal with such a long tail of back-compat support? Requirements wise, the app needs to: - Run on iOS, Android, perhaps later on other devices - Access a few of the local resources, such as address book, push notifications - Store data locally (currently I use Core Data) - Well.. look good, perform animations, not be clunky, feel right... This section is negotiable and it's hard to quantify it but users will know when I bargin too low... Please note that the same (or very similar) question was also asked on Quora but was left unanswered, so maybe SO is better home for it... http://www.quora.com/What-are-the-best-practices-for-continuous-deployment-of-mobile-apps
4
11,104,295
06/19/2012 15:27:39
615,909
02/14/2011 08:46:57
17
1
Hacker Backdoor script?
I found this script attached to a modified index page. This looks like some kind of backdoor. and who is this SAPE ? <?php class SAPE_base { var $_version = '1.0.8'; var $_verbose = false; var $_charset = ''; var $_sape_charset = ''; var $_server_list = array('dispenser-01.sape.ru', 'dispenser-02.sape.ru'); var $_cache_lifetime = 3600; var $_cache_reloadtime = 600; var $_error = ''; var $_host = ''; var $_request_uri = ''; var $_multi_site = false; var $_fetch_remote_type = ''; var $_socket_timeout = 6; var $_force_show_code = false; var $_is_our_bot = false; var $_debug = false; var $_ignore_case = false; var $_db_file = ''; var $_use_server_array = false; var $_force_update_db = false; function SAPE_base($options = null) { $host = ''; if (is_array($options)) { if (isset($options['host'])) { $host = $options['host']; } } elseif (strlen($options)) { $host = $options; $options = array(); } else { $options = array(); } if (isset($options['use_server_array']) && $options['use_server_array'] == true) { $this->_use_server_array = true; } if (strlen($host)) { $this->_host = $host; } else { $this->_host = $_SERVER['HTTP_HOST']; } $this->_host = preg_replace('/^http:\/\//', '', $this->_host); $this->_host = preg_replace('/^www\./', '', $this->_host); if (isset($options['request_uri']) && strlen($options['request_uri'])) { $this->_request_uri = $options['request_uri']; } elseif ($this->_use_server_array === false) { $this->_request_uri = getenv('REQUEST_URI'); } if (strlen($this->_request_uri) == 0) { $this->_request_uri = $_SERVER['REQUEST_URI']; } if (isset($options['multi_site']) && $options['multi_site'] == true) { $this->_multi_site = true; } if (isset($options['debug']) && $options['debug'] == true) { $this->_debug = true; } if (isset($_COOKIE['sape_cookie']) && ($_COOKIE['sape_cookie'] == _SAPE_USER)) { $this->_is_our_bot = true; if (isset($_COOKIE['sape_debug']) && ($_COOKIE['sape_debug'] == 1)) { $this->_debug = true; $this->_options = $options; $this->_server_request_uri = $this->_request_uri = $_SERVER['REQUEST_URI']; $this->_getenv_request_uri = getenv('REQUEST_URI'); $this->_SAPE_USER = _SAPE_USER; } if (isset($_COOKIE['sape_updatedb']) && ($_COOKIE['sape_updatedb'] == 1)) { $this->_force_update_db = true; } } else { $this->_is_our_bot = false; } if (isset($options['verbose']) && $options['verbose'] == true || $this->_debug) { $this->_verbose = true; } if (isset($options['charset']) && strlen($options['charset'])) { $this->_charset = $options['charset']; } else { $this->_charset = 'windows-1251'; } if (isset($options['fetch_remote_type']) && strlen($options['fetch_remote_type'])) { $this->_fetch_remote_type = $options['fetch_remote_type']; } if (isset($options['socket_timeout']) && is_numeric($options['socket_timeout']) && $options['socket_timeout'] > 0) { $this->_socket_timeout = $options['socket_timeout']; } if (isset($options['force_show_code']) && $options['force_show_code'] == true) { $this->_force_show_code = true; } if (!defined('_SAPE_USER')) { return $this->raise_error('Не задана константа _SAPE_USER'); } if (isset($options['ignore_case']) && $options['ignore_case'] == true) { $this->_ignore_case = true; $this->_request_uri = strtolower($this->_request_uri); } } function fetch_remote_file($host, $path) { $user_agent = $this->_user_agent . ' ' . $this->_version; @ini_set('allow_url_fopen', 1); @ini_set('default_socket_timeout', $this->_socket_timeout); @ini_set('user_agent', $user_agent); if ( $this->_fetch_remote_type == 'file_get_contents' || ( $this->_fetch_remote_type == '' && function_exists('file_get_contents') && ini_get('allow_url_fopen') == 1 ) ) { $this->_fetch_remote_type = 'file_get_contents'; if ($data = @file_get_contents('http://' . $host . $path)) { return $data; } } elseif ( $this->_fetch_remote_type == 'curl' || ( $this->_fetch_remote_type == '' && function_exists('curl_init') ) ) { $this->_fetch_remote_type = 'curl'; if ($ch = @curl_init()) { @curl_setopt($ch, CURLOPT_URL, 'http://' . $host . $path); @curl_setopt($ch, CURLOPT_HEADER, false); @curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); @curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $this->_socket_timeout); @curl_setopt($ch, CURLOPT_USERAGENT, $user_agent); if ($data = @curl_exec($ch)) { return $data; } @curl_close($ch); } } else { $this->_fetch_remote_type = 'socket'; $buff = ''; $fp = @fsockopen($host, 80, $errno, $errstr, $this->_socket_timeout); if ($fp) { @fputs($fp, "GET {$path} HTTP/1.0\r\nHost: {$host}\r\n"); @fputs($fp, "User-Agent: {$user_agent}\r\n\r\n"); while (!@feof($fp)) { $buff .= @fgets($fp, 128); } @fclose($fp); $page = explode("\r\n\r\n", $buff); return $page[1]; } } return $this->raise_error('Не могу подключиться к серверу: ' . $host . $path . ', type: ' . $this->_fetch_remote_type); } function _read($filename) { $fp = @fopen($filename, 'rb'); @flock($fp, LOCK_SH); if ($fp) { clearstatcache(); $length = @filesize($filename); $mqr = @get_magic_quotes_runtime(); @set_magic_quotes_runtime(0); if ($length) { $data = @fread($fp, $length); } else { $data = ''; } @set_magic_quotes_runtime($mqr); @flock($fp, LOCK_UN); @fclose($fp); return $data; } return $this->raise_error('Не могу считать данные из файла: ' . $filename); } function _write($filename, $data) { $fp = @fopen($filename, 'ab'); if ($fp) { if (flock($fp, LOCK_EX | LOCK_NB)) { $length = strlen($data); ftruncate($fp, 0); @fwrite($fp, $data, $length); @flock($fp, LOCK_UN); @fclose($fp); if (md5($this->_read($filename)) != md5($data)) { @unlink($filename); return $this->raise_error('Нарушена целостность данных при записи в файл: ' . $filename); } } else { return false; } return true; } return $this->raise_error('Не могу записать данные в файл: ' . $filename); } function raise_error($e) { $this->_error = '<p style="color: red; font-weight: bold;">SAPE ERROR: ' . $e . '</p>'; if ($this->_verbose == true) { print $this->_error; } return false; } function load_data() { $this->_db_file = $this->_get_db_file(); if (!is_file($this->_db_file)) { if (@touch($this->_db_file)) { @chmod($this->_db_file, 0666); } else { return $this->raise_error('Нет файла ' . $this->_db_file . '. Создать не удалось. Выставите права 777 на папку.'); } } if (!is_writable($this->_db_file)) { return $this->raise_error('Нет доступа на запись к файлу: ' . $this->_db_file . '! Выставите права 777 на папку.'); } @clearstatcache(); $data = $this->_read($this->_db_file); if ( $this->_force_update_db || ( !$this->_is_our_bot && ( filemtime($this->_db_file) < (time() - $this->_cache_lifetime) || filesize($this->_db_file) == 0 || @unserialize($data) == false ) ) ) { @touch($this->_db_file, (time() - $this->_cache_lifetime + $this->_cache_reloadtime)); $path = $this->_get_dispenser_path(); if (strlen($this->_charset)) { $path .= '&charset=' . $this->_charset; } foreach ($this->_server_list as $i => $server) { if ($data = $this->fetch_remote_file($server, $path)) { if (substr($data, 0, 12) == 'FATAL ERROR:') { $this->raise_error($data); } else { $hash = @unserialize($data); if ($hash != false) { $hash['__sape_charset__'] = $this->_charset; $hash['__last_update__'] = time(); $hash['__multi_site__'] = $this->_multi_site; $hash['__fetch_remote_type__'] = $this->_fetch_remote_type; $hash['__ignore_case__'] = $this->_ignore_case; $hash['__php_version__'] = phpversion(); $hash['__server_software__'] = $_SERVER['SERVER_SOFTWARE']; $data_new = @serialize($hash); if ($data_new) { $data = $data_new; } $this->_write($this->_db_file, $data); break; } } } } } if (strlen(session_id())) { $session = session_name() . '=' . session_id(); $this->_request_uri = str_replace(array('?' . $session, '&' . $session), '', $this->_request_uri); } $this->set_data(@unserialize($data)); } } class SAPE_client extends SAPE_base { var $_links_delimiter = ''; var $_links = array(); var $_links_page = array(); var $_user_agent = 'SAPE_Client PHP'; function SAPE_client($options = null) { parent::SAPE_base($options); $this->load_data(); } function return_links($n = null, $offset = 0) { if (is_array($this->_links_page)) { $total_page_links = count($this->_links_page); if (!is_numeric($n) || $n > $total_page_links) { $n = $total_page_links; } $links = array(); for ($i = 1; $i <= $n; $i++) { if ($offset > 0 && $i <= $offset) { array_shift($this->_links_page); } else { $links[] = array_shift($this->_links_page); } } $html = join($this->_links_delimiter, $links); if ( strlen($this->_charset) > 0 && strlen($this->_sape_charset) > 0 && $this->_sape_charset != $this->_charset && function_exists('iconv') ) { $new_html = @iconv($this->_sape_charset, $this->_charset, $html); if ($new_html) { $html = $new_html; } } if ($this->_is_our_bot) { $html = '<sape_noindex>' . $html . '</sape_noindex>'; } } else { $html = $this->_links_page; } if ($this->_debug) { $html .= print_r($this, true); } return $html; } function _get_db_file() { if ($this->_multi_site) { return dirname(__FILE__) . '/' . $this->_host . '.links.db'; } else { return dirname(__FILE__) . '/links.db'; } } function _get_dispenser_path() { return '/code.php?user=' . _SAPE_USER . '&host=' . $this->_host; } function set_data($data) { if ($this->_ignore_case) { $this->_links = array_change_key_case($data); } else { $this->_links = $data; } if (isset($this->_links['__sape_delimiter__'])) { $this->_links_delimiter = $this->_links['__sape_delimiter__']; } if (isset($this->_links['__sape_charset__'])) { $this->_sape_charset = $this->_links['__sape_charset__']; } else { $this->_sape_charset = ''; } if (@array_key_exists($this->_request_uri, $this->_links) && is_array($this->_links[$this->_request_uri])) { $this->_links_page = $this->_links[$this->_request_uri]; } else { if (isset($this->_links['__sape_new_url__']) && strlen($this->_links['__sape_new_url__'])) { if ($this->_is_our_bot || $this->_force_show_code) { $this->_links_page = $this->_links['__sape_new_url__']; } } } } } class SAPE_context extends SAPE_base { var $_words = array(); var $_words_page = array(); var $_user_agent = 'SAPE_Context PHP'; var $_filter_tags = array('a', 'textarea', 'select', 'script', 'style', 'label', 'noscript', 'noindex', 'button'); function SAPE_context($options = null) { parent::SAPE_base($options); $this->load_data(); } function replace_in_text_segment($text) { $debug = ''; if ($this->_debug) { $debug .= "<!-- argument for replace_in_text_segment: \r\n" . base64_encode($text) . "\r\n -->"; } if (count($this->_words_page) > 0) { $source_sentence = array(); if ($this->_debug) { $debug .= '<!-- sentences for replace: '; } foreach ($this->_words_page as $n => $sentence) { //Заменяем все сущности на символы $special_chars = array( '&amp;' => '&', '&quot;' => '"', '&#039;' => '\'', '&lt;' => '<', '&gt;' => '>' ); $sentence = strip_tags($sentence); foreach ($special_chars as $from => $to) { str_replace($from, $to, $sentence); } $sentence = htmlspecialchars($sentence); $sentence = preg_quote($sentence, '/'); $replace_array = array(); if (preg_match_all('/(&[#a-zA-Z0-9]{2,6};)/isU', $sentence, $out)) { for ($i = 0; $i < count($out[1]); $i++) { $unspec = $special_chars[$out[1][$i]]; $real = $out[1][$i]; $replace_array[$unspec] = $real; } } foreach ($replace_array as $unspec => $real) { $sentence = str_replace($real, '((' . $real . ')|(' . $unspec . '))', $sentence); } $source_sentences[$n] = str_replace(' ', '((\s)|(&nbsp;))+', $sentence); if ($this->_debug) { $debug .= $source_sentences[$n] . "\r\n\r\n"; } } if ($this->_debug) { $debug .= '-->'; } $first_part = true; if (count($source_sentences) > 0) { $content = ''; $open_tags = array(); $close_tag = ''; $part = strtok(' ' . $text, '<'); while ($part !== false) { if (preg_match('/(?si)^(\/?[a-z0-9]+)/', $part, $matches)) { $tag_name = strtolower($matches[1]); if (substr($tag_name, 0, 1) == '/') { $close_tag = substr($tag_name, 1); if ($this->_debug) { $debug .= '<!-- close_tag: ' . $close_tag . ' -->'; } } else { $close_tag = ''; if ($this->_debug) { $debug .= '<!-- open_tag: ' . $tag_name . ' -->'; } } $cnt_tags = count($open_tags); if (($cnt_tags > 0) && ($open_tags[$cnt_tags - 1] == $close_tag)) { array_pop($open_tags); if ($this->_debug) { $debug .= '<!-- ' . $tag_name . ' - deleted from open_tags -->'; } if ($cnt_tags - 1 == 0) { if ($this->_debug) { $debug .= '<!-- start replacement -->'; } } } if (count($open_tags) == 0) { if (!in_array($tag_name, $this->_filter_tags)) { $split_parts = explode('>', $part, 2); if (count($split_parts) == 2) { foreach ($source_sentences as $n => $sentence) { if (preg_match('/' . $sentence . '/', $split_parts[1]) == 1) { $split_parts[1] = preg_replace('/' . $sentence . '/', str_replace('$', '\$', $this->_words_page[$n]), $split_parts[1], 1); if ($this->_debug) { $debug .= '<!-- ' . $sentence . ' --- ' . $this->_words_page[$n] . ' replaced -->'; } unset($source_sentences[$n]); unset($this->_words_page[$n]); } } $part = $split_parts[0] . '>' . $split_parts[1]; unset($split_parts); } } else { $open_tags[] = $tag_name; if ($this->_debug) { $debug .= '<!-- ' . $tag_name . ' - added to open_tags, stop replacement -->'; } } } } else { foreach ($source_sentences as $n => $sentence) { if (preg_match('/' . $sentence . '/', $part) == 1) { $part = preg_replace('/' . $sentence . '/', str_replace('$', '\$', $this->_words_page[$n]), $part, 1); if ($this->_debug) { $debug .= '<!-- ' . $sentence . ' --- ' . $this->_words_page[$n] . ' replaced -->'; } unset($source_sentences[$n]); unset($this->_words_page[$n]); } } } if ($this->_debug) { $content .= $debug; $debug = ''; } if ($first_part) { $content .= $part; $first_part = false; } else { $content .= $debug . '<' . $part; } unset($part); $part = strtok('<'); } $text = ltrim($content); unset($content); } } else { if ($this->_debug) { $debug .= '<!-- No word`s for page -->'; } } if ($this->_debug) { $debug .= '<!-- END: work of replace_in_text_segment() -->'; } if ($this->_is_our_bot || $this->_force_show_code || $this->_debug) { $text = '<sape_index>' . $text . '</sape_index>'; if (isset($this->_words['__sape_new_url__']) && strlen($this->_words['__sape_new_url__'])) { $text .= $this->_words['__sape_new_url__']; } } if ($this->_debug) { if (count($this->_words_page) > 0) { $text .= '<!-- Not replaced: ' . "\r\n"; foreach ($this->_words_page as $n => $value) { $text .= $value . "\r\n\r\n"; } $text .= '-->'; } $text .= $debug; } return $text; } function replace_in_page(&$buffer) { if (count($this->_words_page) > 0) { $split_content = preg_split('/(?smi)(<\/?sape_index>)/', $buffer, -1); $cnt_parts = count($split_content); if ($cnt_parts > 1) { //Если есть хоть одна пара sape_index, то начинаем работу if ($cnt_parts >= 3) { for ($i = 1; $i < $cnt_parts; $i = $i + 2) { $split_content[$i] = $this->replace_in_text_segment($split_content[$i]); } } $buffer = implode('', $split_content); if ($this->_debug) { $buffer .= '<!-- Split by Sape_index cnt_parts=' . $cnt_parts . '-->'; } } else { $split_content = preg_split('/(?smi)(<\/?body[^>]*>)/', $buffer, -1, PREG_SPLIT_DELIM_CAPTURE); if (count($split_content) == 5) { $split_content[0] = $split_content[0] . $split_content[1]; $split_content[1] = $this->replace_in_text_segment($split_content[2]); $split_content[2] = $split_content[3] . $split_content[4]; unset($split_content[3]); unset($split_content[4]); $buffer = $split_content[0] . $split_content[1] . $split_content[2]; if ($this->_debug) { $buffer .= '<!-- Split by BODY -->'; } } else { if ($this->_debug) { $buffer .= '<!-- Can`t split by BODY -->'; } } } } else { if (!$this->_is_our_bot && !$this->_force_show_code && !$this->_debug) { $buffer = preg_replace('/(?smi)(<\/?sape_index>)/', '', $buffer); } else { if (isset($this->_words['__sape_new_url__']) && strlen($this->_words['__sape_new_url__'])) { $buffer .= $this->_words['__sape_new_url__']; } } if ($this->_debug) { $buffer .= '<!-- No word`s for page -->'; } } return $buffer; } function _get_db_file() { if ($this->_multi_site) { return dirname(__FILE__) . '/' . $this->_host . '.words.db'; } else { return dirname(__FILE__) . '/words.db'; } } function _get_dispenser_path() { return '/code_context.php?user=' . _SAPE_USER . '&host=' . $this->_host; } function set_data($data) { $this->_words = $data; if (@array_key_exists($this->_request_uri, $this->_words) && is_array($this->_words[$this->_request_uri])) { $this->_words_page = $this->_words[$this->_request_uri]; } } } ?>
php
null
null
null
null
06/19/2012 15:34:50
off topic
Hacker Backdoor script? === I found this script attached to a modified index page. This looks like some kind of backdoor. and who is this SAPE ? <?php class SAPE_base { var $_version = '1.0.8'; var $_verbose = false; var $_charset = ''; var $_sape_charset = ''; var $_server_list = array('dispenser-01.sape.ru', 'dispenser-02.sape.ru'); var $_cache_lifetime = 3600; var $_cache_reloadtime = 600; var $_error = ''; var $_host = ''; var $_request_uri = ''; var $_multi_site = false; var $_fetch_remote_type = ''; var $_socket_timeout = 6; var $_force_show_code = false; var $_is_our_bot = false; var $_debug = false; var $_ignore_case = false; var $_db_file = ''; var $_use_server_array = false; var $_force_update_db = false; function SAPE_base($options = null) { $host = ''; if (is_array($options)) { if (isset($options['host'])) { $host = $options['host']; } } elseif (strlen($options)) { $host = $options; $options = array(); } else { $options = array(); } if (isset($options['use_server_array']) && $options['use_server_array'] == true) { $this->_use_server_array = true; } if (strlen($host)) { $this->_host = $host; } else { $this->_host = $_SERVER['HTTP_HOST']; } $this->_host = preg_replace('/^http:\/\//', '', $this->_host); $this->_host = preg_replace('/^www\./', '', $this->_host); if (isset($options['request_uri']) && strlen($options['request_uri'])) { $this->_request_uri = $options['request_uri']; } elseif ($this->_use_server_array === false) { $this->_request_uri = getenv('REQUEST_URI'); } if (strlen($this->_request_uri) == 0) { $this->_request_uri = $_SERVER['REQUEST_URI']; } if (isset($options['multi_site']) && $options['multi_site'] == true) { $this->_multi_site = true; } if (isset($options['debug']) && $options['debug'] == true) { $this->_debug = true; } if (isset($_COOKIE['sape_cookie']) && ($_COOKIE['sape_cookie'] == _SAPE_USER)) { $this->_is_our_bot = true; if (isset($_COOKIE['sape_debug']) && ($_COOKIE['sape_debug'] == 1)) { $this->_debug = true; $this->_options = $options; $this->_server_request_uri = $this->_request_uri = $_SERVER['REQUEST_URI']; $this->_getenv_request_uri = getenv('REQUEST_URI'); $this->_SAPE_USER = _SAPE_USER; } if (isset($_COOKIE['sape_updatedb']) && ($_COOKIE['sape_updatedb'] == 1)) { $this->_force_update_db = true; } } else { $this->_is_our_bot = false; } if (isset($options['verbose']) && $options['verbose'] == true || $this->_debug) { $this->_verbose = true; } if (isset($options['charset']) && strlen($options['charset'])) { $this->_charset = $options['charset']; } else { $this->_charset = 'windows-1251'; } if (isset($options['fetch_remote_type']) && strlen($options['fetch_remote_type'])) { $this->_fetch_remote_type = $options['fetch_remote_type']; } if (isset($options['socket_timeout']) && is_numeric($options['socket_timeout']) && $options['socket_timeout'] > 0) { $this->_socket_timeout = $options['socket_timeout']; } if (isset($options['force_show_code']) && $options['force_show_code'] == true) { $this->_force_show_code = true; } if (!defined('_SAPE_USER')) { return $this->raise_error('Не задана константа _SAPE_USER'); } if (isset($options['ignore_case']) && $options['ignore_case'] == true) { $this->_ignore_case = true; $this->_request_uri = strtolower($this->_request_uri); } } function fetch_remote_file($host, $path) { $user_agent = $this->_user_agent . ' ' . $this->_version; @ini_set('allow_url_fopen', 1); @ini_set('default_socket_timeout', $this->_socket_timeout); @ini_set('user_agent', $user_agent); if ( $this->_fetch_remote_type == 'file_get_contents' || ( $this->_fetch_remote_type == '' && function_exists('file_get_contents') && ini_get('allow_url_fopen') == 1 ) ) { $this->_fetch_remote_type = 'file_get_contents'; if ($data = @file_get_contents('http://' . $host . $path)) { return $data; } } elseif ( $this->_fetch_remote_type == 'curl' || ( $this->_fetch_remote_type == '' && function_exists('curl_init') ) ) { $this->_fetch_remote_type = 'curl'; if ($ch = @curl_init()) { @curl_setopt($ch, CURLOPT_URL, 'http://' . $host . $path); @curl_setopt($ch, CURLOPT_HEADER, false); @curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); @curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $this->_socket_timeout); @curl_setopt($ch, CURLOPT_USERAGENT, $user_agent); if ($data = @curl_exec($ch)) { return $data; } @curl_close($ch); } } else { $this->_fetch_remote_type = 'socket'; $buff = ''; $fp = @fsockopen($host, 80, $errno, $errstr, $this->_socket_timeout); if ($fp) { @fputs($fp, "GET {$path} HTTP/1.0\r\nHost: {$host}\r\n"); @fputs($fp, "User-Agent: {$user_agent}\r\n\r\n"); while (!@feof($fp)) { $buff .= @fgets($fp, 128); } @fclose($fp); $page = explode("\r\n\r\n", $buff); return $page[1]; } } return $this->raise_error('Не могу подключиться к серверу: ' . $host . $path . ', type: ' . $this->_fetch_remote_type); } function _read($filename) { $fp = @fopen($filename, 'rb'); @flock($fp, LOCK_SH); if ($fp) { clearstatcache(); $length = @filesize($filename); $mqr = @get_magic_quotes_runtime(); @set_magic_quotes_runtime(0); if ($length) { $data = @fread($fp, $length); } else { $data = ''; } @set_magic_quotes_runtime($mqr); @flock($fp, LOCK_UN); @fclose($fp); return $data; } return $this->raise_error('Не могу считать данные из файла: ' . $filename); } function _write($filename, $data) { $fp = @fopen($filename, 'ab'); if ($fp) { if (flock($fp, LOCK_EX | LOCK_NB)) { $length = strlen($data); ftruncate($fp, 0); @fwrite($fp, $data, $length); @flock($fp, LOCK_UN); @fclose($fp); if (md5($this->_read($filename)) != md5($data)) { @unlink($filename); return $this->raise_error('Нарушена целостность данных при записи в файл: ' . $filename); } } else { return false; } return true; } return $this->raise_error('Не могу записать данные в файл: ' . $filename); } function raise_error($e) { $this->_error = '<p style="color: red; font-weight: bold;">SAPE ERROR: ' . $e . '</p>'; if ($this->_verbose == true) { print $this->_error; } return false; } function load_data() { $this->_db_file = $this->_get_db_file(); if (!is_file($this->_db_file)) { if (@touch($this->_db_file)) { @chmod($this->_db_file, 0666); } else { return $this->raise_error('Нет файла ' . $this->_db_file . '. Создать не удалось. Выставите права 777 на папку.'); } } if (!is_writable($this->_db_file)) { return $this->raise_error('Нет доступа на запись к файлу: ' . $this->_db_file . '! Выставите права 777 на папку.'); } @clearstatcache(); $data = $this->_read($this->_db_file); if ( $this->_force_update_db || ( !$this->_is_our_bot && ( filemtime($this->_db_file) < (time() - $this->_cache_lifetime) || filesize($this->_db_file) == 0 || @unserialize($data) == false ) ) ) { @touch($this->_db_file, (time() - $this->_cache_lifetime + $this->_cache_reloadtime)); $path = $this->_get_dispenser_path(); if (strlen($this->_charset)) { $path .= '&charset=' . $this->_charset; } foreach ($this->_server_list as $i => $server) { if ($data = $this->fetch_remote_file($server, $path)) { if (substr($data, 0, 12) == 'FATAL ERROR:') { $this->raise_error($data); } else { $hash = @unserialize($data); if ($hash != false) { $hash['__sape_charset__'] = $this->_charset; $hash['__last_update__'] = time(); $hash['__multi_site__'] = $this->_multi_site; $hash['__fetch_remote_type__'] = $this->_fetch_remote_type; $hash['__ignore_case__'] = $this->_ignore_case; $hash['__php_version__'] = phpversion(); $hash['__server_software__'] = $_SERVER['SERVER_SOFTWARE']; $data_new = @serialize($hash); if ($data_new) { $data = $data_new; } $this->_write($this->_db_file, $data); break; } } } } } if (strlen(session_id())) { $session = session_name() . '=' . session_id(); $this->_request_uri = str_replace(array('?' . $session, '&' . $session), '', $this->_request_uri); } $this->set_data(@unserialize($data)); } } class SAPE_client extends SAPE_base { var $_links_delimiter = ''; var $_links = array(); var $_links_page = array(); var $_user_agent = 'SAPE_Client PHP'; function SAPE_client($options = null) { parent::SAPE_base($options); $this->load_data(); } function return_links($n = null, $offset = 0) { if (is_array($this->_links_page)) { $total_page_links = count($this->_links_page); if (!is_numeric($n) || $n > $total_page_links) { $n = $total_page_links; } $links = array(); for ($i = 1; $i <= $n; $i++) { if ($offset > 0 && $i <= $offset) { array_shift($this->_links_page); } else { $links[] = array_shift($this->_links_page); } } $html = join($this->_links_delimiter, $links); if ( strlen($this->_charset) > 0 && strlen($this->_sape_charset) > 0 && $this->_sape_charset != $this->_charset && function_exists('iconv') ) { $new_html = @iconv($this->_sape_charset, $this->_charset, $html); if ($new_html) { $html = $new_html; } } if ($this->_is_our_bot) { $html = '<sape_noindex>' . $html . '</sape_noindex>'; } } else { $html = $this->_links_page; } if ($this->_debug) { $html .= print_r($this, true); } return $html; } function _get_db_file() { if ($this->_multi_site) { return dirname(__FILE__) . '/' . $this->_host . '.links.db'; } else { return dirname(__FILE__) . '/links.db'; } } function _get_dispenser_path() { return '/code.php?user=' . _SAPE_USER . '&host=' . $this->_host; } function set_data($data) { if ($this->_ignore_case) { $this->_links = array_change_key_case($data); } else { $this->_links = $data; } if (isset($this->_links['__sape_delimiter__'])) { $this->_links_delimiter = $this->_links['__sape_delimiter__']; } if (isset($this->_links['__sape_charset__'])) { $this->_sape_charset = $this->_links['__sape_charset__']; } else { $this->_sape_charset = ''; } if (@array_key_exists($this->_request_uri, $this->_links) && is_array($this->_links[$this->_request_uri])) { $this->_links_page = $this->_links[$this->_request_uri]; } else { if (isset($this->_links['__sape_new_url__']) && strlen($this->_links['__sape_new_url__'])) { if ($this->_is_our_bot || $this->_force_show_code) { $this->_links_page = $this->_links['__sape_new_url__']; } } } } } class SAPE_context extends SAPE_base { var $_words = array(); var $_words_page = array(); var $_user_agent = 'SAPE_Context PHP'; var $_filter_tags = array('a', 'textarea', 'select', 'script', 'style', 'label', 'noscript', 'noindex', 'button'); function SAPE_context($options = null) { parent::SAPE_base($options); $this->load_data(); } function replace_in_text_segment($text) { $debug = ''; if ($this->_debug) { $debug .= "<!-- argument for replace_in_text_segment: \r\n" . base64_encode($text) . "\r\n -->"; } if (count($this->_words_page) > 0) { $source_sentence = array(); if ($this->_debug) { $debug .= '<!-- sentences for replace: '; } foreach ($this->_words_page as $n => $sentence) { //Заменяем все сущности на символы $special_chars = array( '&amp;' => '&', '&quot;' => '"', '&#039;' => '\'', '&lt;' => '<', '&gt;' => '>' ); $sentence = strip_tags($sentence); foreach ($special_chars as $from => $to) { str_replace($from, $to, $sentence); } $sentence = htmlspecialchars($sentence); $sentence = preg_quote($sentence, '/'); $replace_array = array(); if (preg_match_all('/(&[#a-zA-Z0-9]{2,6};)/isU', $sentence, $out)) { for ($i = 0; $i < count($out[1]); $i++) { $unspec = $special_chars[$out[1][$i]]; $real = $out[1][$i]; $replace_array[$unspec] = $real; } } foreach ($replace_array as $unspec => $real) { $sentence = str_replace($real, '((' . $real . ')|(' . $unspec . '))', $sentence); } $source_sentences[$n] = str_replace(' ', '((\s)|(&nbsp;))+', $sentence); if ($this->_debug) { $debug .= $source_sentences[$n] . "\r\n\r\n"; } } if ($this->_debug) { $debug .= '-->'; } $first_part = true; if (count($source_sentences) > 0) { $content = ''; $open_tags = array(); $close_tag = ''; $part = strtok(' ' . $text, '<'); while ($part !== false) { if (preg_match('/(?si)^(\/?[a-z0-9]+)/', $part, $matches)) { $tag_name = strtolower($matches[1]); if (substr($tag_name, 0, 1) == '/') { $close_tag = substr($tag_name, 1); if ($this->_debug) { $debug .= '<!-- close_tag: ' . $close_tag . ' -->'; } } else { $close_tag = ''; if ($this->_debug) { $debug .= '<!-- open_tag: ' . $tag_name . ' -->'; } } $cnt_tags = count($open_tags); if (($cnt_tags > 0) && ($open_tags[$cnt_tags - 1] == $close_tag)) { array_pop($open_tags); if ($this->_debug) { $debug .= '<!-- ' . $tag_name . ' - deleted from open_tags -->'; } if ($cnt_tags - 1 == 0) { if ($this->_debug) { $debug .= '<!-- start replacement -->'; } } } if (count($open_tags) == 0) { if (!in_array($tag_name, $this->_filter_tags)) { $split_parts = explode('>', $part, 2); if (count($split_parts) == 2) { foreach ($source_sentences as $n => $sentence) { if (preg_match('/' . $sentence . '/', $split_parts[1]) == 1) { $split_parts[1] = preg_replace('/' . $sentence . '/', str_replace('$', '\$', $this->_words_page[$n]), $split_parts[1], 1); if ($this->_debug) { $debug .= '<!-- ' . $sentence . ' --- ' . $this->_words_page[$n] . ' replaced -->'; } unset($source_sentences[$n]); unset($this->_words_page[$n]); } } $part = $split_parts[0] . '>' . $split_parts[1]; unset($split_parts); } } else { $open_tags[] = $tag_name; if ($this->_debug) { $debug .= '<!-- ' . $tag_name . ' - added to open_tags, stop replacement -->'; } } } } else { foreach ($source_sentences as $n => $sentence) { if (preg_match('/' . $sentence . '/', $part) == 1) { $part = preg_replace('/' . $sentence . '/', str_replace('$', '\$', $this->_words_page[$n]), $part, 1); if ($this->_debug) { $debug .= '<!-- ' . $sentence . ' --- ' . $this->_words_page[$n] . ' replaced -->'; } unset($source_sentences[$n]); unset($this->_words_page[$n]); } } } if ($this->_debug) { $content .= $debug; $debug = ''; } if ($first_part) { $content .= $part; $first_part = false; } else { $content .= $debug . '<' . $part; } unset($part); $part = strtok('<'); } $text = ltrim($content); unset($content); } } else { if ($this->_debug) { $debug .= '<!-- No word`s for page -->'; } } if ($this->_debug) { $debug .= '<!-- END: work of replace_in_text_segment() -->'; } if ($this->_is_our_bot || $this->_force_show_code || $this->_debug) { $text = '<sape_index>' . $text . '</sape_index>'; if (isset($this->_words['__sape_new_url__']) && strlen($this->_words['__sape_new_url__'])) { $text .= $this->_words['__sape_new_url__']; } } if ($this->_debug) { if (count($this->_words_page) > 0) { $text .= '<!-- Not replaced: ' . "\r\n"; foreach ($this->_words_page as $n => $value) { $text .= $value . "\r\n\r\n"; } $text .= '-->'; } $text .= $debug; } return $text; } function replace_in_page(&$buffer) { if (count($this->_words_page) > 0) { $split_content = preg_split('/(?smi)(<\/?sape_index>)/', $buffer, -1); $cnt_parts = count($split_content); if ($cnt_parts > 1) { //Если есть хоть одна пара sape_index, то начинаем работу if ($cnt_parts >= 3) { for ($i = 1; $i < $cnt_parts; $i = $i + 2) { $split_content[$i] = $this->replace_in_text_segment($split_content[$i]); } } $buffer = implode('', $split_content); if ($this->_debug) { $buffer .= '<!-- Split by Sape_index cnt_parts=' . $cnt_parts . '-->'; } } else { $split_content = preg_split('/(?smi)(<\/?body[^>]*>)/', $buffer, -1, PREG_SPLIT_DELIM_CAPTURE); if (count($split_content) == 5) { $split_content[0] = $split_content[0] . $split_content[1]; $split_content[1] = $this->replace_in_text_segment($split_content[2]); $split_content[2] = $split_content[3] . $split_content[4]; unset($split_content[3]); unset($split_content[4]); $buffer = $split_content[0] . $split_content[1] . $split_content[2]; if ($this->_debug) { $buffer .= '<!-- Split by BODY -->'; } } else { if ($this->_debug) { $buffer .= '<!-- Can`t split by BODY -->'; } } } } else { if (!$this->_is_our_bot && !$this->_force_show_code && !$this->_debug) { $buffer = preg_replace('/(?smi)(<\/?sape_index>)/', '', $buffer); } else { if (isset($this->_words['__sape_new_url__']) && strlen($this->_words['__sape_new_url__'])) { $buffer .= $this->_words['__sape_new_url__']; } } if ($this->_debug) { $buffer .= '<!-- No word`s for page -->'; } } return $buffer; } function _get_db_file() { if ($this->_multi_site) { return dirname(__FILE__) . '/' . $this->_host . '.words.db'; } else { return dirname(__FILE__) . '/words.db'; } } function _get_dispenser_path() { return '/code_context.php?user=' . _SAPE_USER . '&host=' . $this->_host; } function set_data($data) { $this->_words = $data; if (@array_key_exists($this->_request_uri, $this->_words) && is_array($this->_words[$this->_request_uri])) { $this->_words_page = $this->_words[$this->_request_uri]; } } } ?>
2
11,736,111
07/31/2012 08:33:16
872,998
08/01/2011 14:57:05
102
5
create a custom profile class but error in subfolder
I am working with mvc 3 jquery mobile project. I crated a custom profile class in project to save in aspnet_profile table with the help of: http://weblogs.asp.net/jgalloway/archive/2008/01/19/writing-a-custom-asp-net-profile-class.aspx .and in my server i have subfolder called 'admin' and i placed some aspx files in it. when i accessing like http://www.mywebsite.com/admin it gives error( The type or namespace name 'Root' could not be found (are you missing a using directive or an assembly reference?) ).but it works fine like http://www.mywebsite.com.
asp.net
asp.net-mvc-3
profile
null
null
null
open
create a custom profile class but error in subfolder === I am working with mvc 3 jquery mobile project. I crated a custom profile class in project to save in aspnet_profile table with the help of: http://weblogs.asp.net/jgalloway/archive/2008/01/19/writing-a-custom-asp-net-profile-class.aspx .and in my server i have subfolder called 'admin' and i placed some aspx files in it. when i accessing like http://www.mywebsite.com/admin it gives error( The type or namespace name 'Root' could not be found (are you missing a using directive or an assembly reference?) ).but it works fine like http://www.mywebsite.com.
0
8,389,569
12/05/2011 17:47:53
888,139
08/10/2011 14:45:15
102
2
CSS: select element preceded by a sibling element
I have something similar to the following: <ul id="list-cats"> <li><img src="..." alt="" /><a href="#">test 1</a></li> <li><img src="..." alt="" /><a href="#">test 2</a></li> <li><img src="..." alt="" /><a href="#">test 2</a></li> </ul> ul#list-cats li {border:1px solid red;} ul#list-cats li li {border:1px solid cyan;} This is from the w3c documentation: E + F Matches any F element immediately preceded by a sibling element E. Why dont all the other "li" tags get a cyan border? PS: i know this can be done using the first:child selector... but, i want to figure this problem out
css
selector
null
null
null
02/10/2012 12:52:42
too localized
CSS: select element preceded by a sibling element === I have something similar to the following: <ul id="list-cats"> <li><img src="..." alt="" /><a href="#">test 1</a></li> <li><img src="..." alt="" /><a href="#">test 2</a></li> <li><img src="..." alt="" /><a href="#">test 2</a></li> </ul> ul#list-cats li {border:1px solid red;} ul#list-cats li li {border:1px solid cyan;} This is from the w3c documentation: E + F Matches any F element immediately preceded by a sibling element E. Why dont all the other "li" tags get a cyan border? PS: i know this can be done using the first:child selector... but, i want to figure this problem out
3
11,496,286
07/15/2012 22:46:24
1,527,464
07/15/2012 21:07:55
1
0
Programming STM32-p207 using JTAG
I am a newbie learning to do ARM development. I have the following development hardware Olimex STM32-P207 (https://www.olimex.com/dev/stm32-p207.html) Olimex ARM-USB-TINY-H The STM32-P207 user guide mentions the following- *"Note: additionally, the board can be programmed via JTAG interface but there are signals multiplexed with the LCD and the audio, so if using JTAG interface for programming you might need to implement a software mechanism to stop them or you might not be able to reprogram again"* Can anyone explain me what exactly needs to be done so that I don't mess up with my new board? Thank you.
embedded
arm
development-environment
stm32
jtag
07/15/2012 22:48:27
off topic
Programming STM32-p207 using JTAG === I am a newbie learning to do ARM development. I have the following development hardware Olimex STM32-P207 (https://www.olimex.com/dev/stm32-p207.html) Olimex ARM-USB-TINY-H The STM32-P207 user guide mentions the following- *"Note: additionally, the board can be programmed via JTAG interface but there are signals multiplexed with the LCD and the audio, so if using JTAG interface for programming you might need to implement a software mechanism to stop them or you might not be able to reprogram again"* Can anyone explain me what exactly needs to be done so that I don't mess up with my new board? Thank you.
2
3,403,247
08/04/2010 06:55:05
348,311
05/23/2010 14:58:10
173
9
Dealing with file properties C#
I want to get the file size of any given file using the C#, and I need to show it in GB, MB, KB and bytes if possible ... and for audio (mp3) files, I need to get the duration of the file ...
c#
filesystems
null
null
null
null
open
Dealing with file properties C# === I want to get the file size of any given file using the C#, and I need to show it in GB, MB, KB and bytes if possible ... and for audio (mp3) files, I need to get the duration of the file ...
0
10,721,364
05/23/2012 13:49:32
1,166,690
01/24/2012 09:52:21
814
4
XSLT output method while signing?
I am using XSLT transform in my xmlsignatures. The XSLT template's output value is **HTML** like this <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="html" version="4.0" encoding="iso-8859-1" indent="yes"/> I have to use this XSLT in two places <br> **1) While Signing the XML document with XSLT transform**<br> **2) While Rendering the values specified by XSLT from signed document**<br><br> What is bothering me is that When I sign the document with XSLT transform, Will the following line gets executed <xsl:output method="html" version="4.0" encoding="iso-8859-1" indent="yes"/> **If its executed then Where will be the HTML file shown?**
java
html
xslt
xpath
xml-signature
05/25/2012 03:56:36
not a real question
XSLT output method while signing? === I am using XSLT transform in my xmlsignatures. The XSLT template's output value is **HTML** like this <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="html" version="4.0" encoding="iso-8859-1" indent="yes"/> I have to use this XSLT in two places <br> **1) While Signing the XML document with XSLT transform**<br> **2) While Rendering the values specified by XSLT from signed document**<br><br> What is bothering me is that When I sign the document with XSLT transform, Will the following line gets executed <xsl:output method="html" version="4.0" encoding="iso-8859-1" indent="yes"/> **If its executed then Where will be the HTML file shown?**
1
3,060,824
06/17/2010 10:28:40
358,450
06/04/2010 12:47:51
81
0
css sprite navigation
Is it possible to use three images in CSS sprite navigation? This may be like this ![My image][1] [1]: http://img710.imageshack.us/img710/1429/navigx.jpg
html
css
css-sprites
null
null
null
open
css sprite navigation === Is it possible to use three images in CSS sprite navigation? This may be like this ![My image][1] [1]: http://img710.imageshack.us/img710/1429/navigx.jpg
0
1,537,043
10/08/2009 10:50:47
120,497
06/10/2009 12:30:21
15
0
Caching IEnumerable
public IEnumerable<ModuleData> ListModules() { foreach (XElement m in Source.Descendants("Module")) { yield return new ModuleData(m.Element("ModuleID").Value); } } Initially the above code is great since there is no need to evaluate the entire collection if it is not needed. However, once all the Modules have been enumerated once, it becomes more expensive to repeatedly query the XDocument when there is no change. So, as a performance improvement: public IEnumerable<ModuleData> ListModules() { if (Modules == null) { Modules = new List<ModuleData>(); foreach (XElement m in Source.Descendants("Module")) { Modules.Add(new ModuleData(m.Element("ModuleID").Value, 1, 1)); } } return Modules; } Which is great if I am repeatedly using the entire list but not so great otherwise. Is there a middle ground where I can yield return until the entire list has been iterated, then cache it and serve the cache to subsequent requests?
ienumerable
yield
return
null
null
null
open
Caching IEnumerable === public IEnumerable<ModuleData> ListModules() { foreach (XElement m in Source.Descendants("Module")) { yield return new ModuleData(m.Element("ModuleID").Value); } } Initially the above code is great since there is no need to evaluate the entire collection if it is not needed. However, once all the Modules have been enumerated once, it becomes more expensive to repeatedly query the XDocument when there is no change. So, as a performance improvement: public IEnumerable<ModuleData> ListModules() { if (Modules == null) { Modules = new List<ModuleData>(); foreach (XElement m in Source.Descendants("Module")) { Modules.Add(new ModuleData(m.Element("ModuleID").Value, 1, 1)); } } return Modules; } Which is great if I am repeatedly using the entire list but not so great otherwise. Is there a middle ground where I can yield return until the entire list has been iterated, then cache it and serve the cache to subsequent requests?
0
3,241,968
07/13/2010 22:11:24
47,086
12/17/2008 15:24:53
351
36
Charateristics and features of every software framework
I was trying to find an answer for my question today using google and StackOverflow search engines... but no luck :) I was wondering what are the key features of every framework for end user, and how can you characterize every framework from the end-user point of view (I've looked into Framework Design Guidelines by K. Cwalina, but I've found only concepts and guidelines for framework architects), for me: - it should be extensible - should let build extensible and reusable component I think there is much more out there. Please share your knowledge.
language-agnostic
frameworks
framework
features
characteristics
null
open
Charateristics and features of every software framework === I was trying to find an answer for my question today using google and StackOverflow search engines... but no luck :) I was wondering what are the key features of every framework for end user, and how can you characterize every framework from the end-user point of view (I've looked into Framework Design Guidelines by K. Cwalina, but I've found only concepts and guidelines for framework architects), for me: - it should be extensible - should let build extensible and reusable component I think there is much more out there. Please share your knowledge.
0
9,338,678
02/18/2012 04:52:38
1,202,349
02/10/2012 15:40:43
42
1
What is the main difference between Agile Software Development & Extreme Programming?
Title has it. Just to have an idea, pointing to some good links with documentations are good enough.
project-management
agile
extreme-programming
null
null
02/18/2012 04:59:16
off topic
What is the main difference between Agile Software Development & Extreme Programming? === Title has it. Just to have an idea, pointing to some good links with documentations are good enough.
2
2,843,279
05/16/2010 10:00:30
302,954
03/26/2010 23:55:39
11
0
Asp.Net Cookie sharing
This is C#.Net code: How to share Cookie between 2 HttpWebRequest calls? Details: I am posting a form in first request, this form contains some setting variables which are used by the system. lets say there is a input field in the form which sets the size of grid pages to be displayed in other pages. Once i have updated the setings in previous request, i go to send a request to another page which shows off asp.net gridview/grid. The grid might contaian several pages and the page size should be the one which i set in previous request. But when i do this via HttpWebReeust it does not happen. When i do it via browser, loading the setting page in the browser and then going to the grid view page... i see the page size is updated. I want to achieve this via code. Sicne i am scraping this grid. i have to set page size or visit the gird pages one by one via code. Or is it possible to set a cookie on 2nd request which is used to set in first request? It will be great if i go this way. any solution?
asp.net
gridview
setcookie
null
null
null
open
Asp.Net Cookie sharing === This is C#.Net code: How to share Cookie between 2 HttpWebRequest calls? Details: I am posting a form in first request, this form contains some setting variables which are used by the system. lets say there is a input field in the form which sets the size of grid pages to be displayed in other pages. Once i have updated the setings in previous request, i go to send a request to another page which shows off asp.net gridview/grid. The grid might contaian several pages and the page size should be the one which i set in previous request. But when i do this via HttpWebReeust it does not happen. When i do it via browser, loading the setting page in the browser and then going to the grid view page... i see the page size is updated. I want to achieve this via code. Sicne i am scraping this grid. i have to set page size or visit the gird pages one by one via code. Or is it possible to set a cookie on 2nd request which is used to set in first request? It will be great if i go this way. any solution?
0
8,877,240
01/16/2012 08:18:54
665,557
03/18/2011 05:25:07
551
2
LIKE Buttons from Facebook Using Open Graph API
I have a website that has movies and reviews. On a particular movie page, I have a movie title and a Facebook like button. I want this like button to use the Open Graph API. But beneath the movie, I have reviews that also have like buttons. I want these reviews to not use the graph API and just use the link to the review as the like. Is this possible?
facebook
facebook-graph-api
facebook-like
null
null
null
open
LIKE Buttons from Facebook Using Open Graph API === I have a website that has movies and reviews. On a particular movie page, I have a movie title and a Facebook like button. I want this like button to use the Open Graph API. But beneath the movie, I have reviews that also have like buttons. I want these reviews to not use the graph API and just use the link to the review as the like. Is this possible?
0
8,098,803
11/11/2011 19:15:47
1,042,276
11/11/2011 18:52:53
1
0
error C2593: 'operator =' is ambiguous
when i compile in VS 2003 ent i get these errors C:\SRC\Program\_Interface\FuncTextCmd.cpp(953): error C2593: 'operator =' is ambiguous C:\SRC\Program\_Interface\FuncTextCmd.cpp(958): error C2593: 'operator =' is ambiguous C:\SRC\Program\_Interface\FuncTextCmd.cpp(963): error C2593: 'operator =' is ambiguous C:\SRC\Program\_Interface\FuncTextCmd.cpp(968): error C2593: 'operator =' is ambiguous C:\SRC\Program\_Interface\FuncTextCmd.cpp(973): error C2593: 'operator =' is ambiguous C:\SRC\Program\_Interface\FuncTextCmd.cpp(978): error C2593: 'operator =' is ambiguous C:\SRC\Program\_Interface\FuncTextCmd.cpp(982): error C2593: 'operator =' is ambiguous this is this part of FuncTextCmd.cpp it's referring to BOOL TextCmd_CHANGEGLOW( CScanner& scanner ) {//98 #ifdef __WORLDSERVER CUser* pUser = (CUser*)scanner.dwValue; scanner.GetToken(); CString strcr = scanner.Token; CString CHANGEGLOW; if( 2 <= strcr.GetLength() && strcr.GetLength() <= 7) { strcr.MakeLower(); if( strcmp( strcr, "RED" ) == 0 ) { CHANGEGLOW = 1;//line 953 } else if( strcmp( strcr, "BLUE" ) == 0 ) { CHANGEGLOW = 2;//line 958 } else if( strcmp( strcr, "GREEN" ) == 0 ) { CHANGEGLOW = 3;//line 963 } else if( strcmp( strcr, "YELLOW" ) == 0 ) { CHANGEGLOW = 4;//line 968 } else if( strcmp( strcr, "ORANGE" ) == 0 ) { CHANGEGLOW = 5;//line 973 } else if( strcmp( strcr, "PINK" ) == 0 ) { CHANGEGLOW = 6;//line 978 } else if( strcmp( strcr, "PURPLE" ) == 0 ) { CHANGEGLOW = 7;//line 982 } else { strcr += "unknown glow"; pUser->AddText( strcr ); return FALSE; } } else { strcr += "unknown glow"; pUser->AddText( strcr ); return FALSE; }//2 #endif // __WORLDSERVER return TRUE; } this is for a game by the way it's in c++ the part above is saying if the user types said colors in the chat box then the glow around their body will change to what they typed but this is only the command the main part of this feature is handled in Mover.cpp of my source then part for glow can be seen below void CMover::CreateAbilityOption_SetItemSFX( int nAbilityOption ) { extern DWORD CHANGEGLOW; DWORD dwSfx = 0; switch( nAbilityOption ) { case 3: dwSfx = XI_GEN_ITEM_SETITEM03; break; case 4: dwSfx = XI_GEN_ITEM_SETITEM04; break; case 5: dwSfx = XI_GEN_ITEM_SETITEM05; break; case 6: dwSfx = XI_GEN_ITEM_SETITEM06; break; case 7: dwSfx = XI_GEN_ITEM_SETITEM07; break; case 8: dwSfx = XI_GEN_ITEM_SETITEM08; break; case 9: dwSfx = XI_GEN_ITEM_SETITEM09; break; case 10: dwSfx = CHANGEGLOW; break; } switch( CHANGEGLOW ) { case 1: dwSfx = RED; break; //make sure that the uppercase RED is what //you defined in defineobj.h case 2: dwSfx = BLUE; break; //make sure that the uppercase BLUE is what // you defined //in defineobj.h case 3: dwSfx = GREEN; break; //make sure that the uppercase GREEN is what you //defined in defineobj.h case 4: dwSfx = YELLOW; break; //make sure that the uppercase YELLOW is what you //defined in defineobj.h case 5: dwSfx = ORANGE; break; //make sure that the uppercase ORANGE is what you //defined in defineobj.h case 6: dwSfx = PINK; break; //make sure that the uppercase PINK is what you //defined in defineobj.h case 7: dwSfx = PURPLE; break; //make sure that the uppercase PURPLE is what you //defined in defineobj.h } //else //case 10: dwSfx = XI_GEN_ITEM_SETITEM10; break; CSfxPartsLinkShoulder* pSfx = NULL; D3DXVECTOR3 v3Scal = D3DXVECTOR3( 1.0f, 1.0f, 1.0f ); if( nAbilityOption == 3 ) { // ¾î±ú pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 ); pSfx->m_nPartsLink = 0; pSfx->m_v3Offset.y = 0.1f; pSfx->m_nOldAbilityOption = nAbilityOption; pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 ); pSfx->m_nPartsLink = 1; pSfx->m_v3Offset.y = 0.1f; pSfx->m_nOldAbilityOption = nAbilityOption; } /* else if( nAbilityOption == 4 ) { // ¸öÅë pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 ); pSfx->m_nPartsLink = 6; pSfx->SetScale(D3DXVECTOR3( 2.2f, 2.2f, 2.2f )); } */ else if( nAbilityOption == 4 ) { // ¸öÅë pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 ); pSfx->m_nPartsLink = 6; pSfx->SetScale(D3DXVECTOR3( 3.0f, 3.0f, 3.0f )); pSfx->m_nOldAbilityOption = nAbilityOption; } else if( nAbilityOption == 5 ) { // ¾î±ú pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 ); pSfx->m_nPartsLink = 0; pSfx->m_v3Offset.y = 0.1f; pSfx->m_nOldAbilityOption = nAbilityOption; pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 ); pSfx->m_nPartsLink = 1; pSfx->m_v3Offset.y = 0.1f; pSfx->m_nOldAbilityOption = nAbilityOption; // ¾î±ú, ÆÈ¸ñ Áß°£ pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 ); pSfx->m_nPartsLink = 4; pSfx->m_nOldAbilityOption = nAbilityOption; pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 ); pSfx->m_nPartsLink = 5; pSfx->m_nOldAbilityOption = nAbilityOption; } else if( nAbilityOption == 6 ) { // ¾î±ú pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 ); pSfx->m_nPartsLink = 0; pSfx->m_nOldAbilityOption = nAbilityOption; pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 ); pSfx->m_nPartsLink = 1; pSfx->m_nOldAbilityOption = nAbilityOption; // ¾î±ú, ÆÈ¸ñ Áß°£ pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 ); pSfx->m_nPartsLink = 4; pSfx->m_nOldAbilityOption = nAbilityOption; pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 ); pSfx->m_nPartsLink = 5; pSfx->m_nOldAbilityOption = nAbilityOption; // ÆÈ¸ñ pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 ); pSfx->m_nPartsLink = 2; pSfx->m_v3Offset.y = 0.1f; pSfx->m_nOldAbilityOption = nAbilityOption; pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 ); pSfx->m_nPartsLink = 3; pSfx->m_v3Offset.y = 0.1f; pSfx->m_nOldAbilityOption = nAbilityOption; } else if( nAbilityOption == 7 ) { // ¾î±ú pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 ); pSfx->m_nPartsLink = 0; pSfx->m_nOldAbilityOption = nAbilityOption; pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 ); pSfx->m_nPartsLink = 1; pSfx->m_nOldAbilityOption = nAbilityOption; // ¾î±ú, ÆÈ¸ñ Áß°£ pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 ); pSfx->m_nPartsLink = 4; pSfx->m_nOldAbilityOption = nAbilityOption; pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 ); pSfx->m_nPartsLink = 5; pSfx->m_nOldAbilityOption = nAbilityOption; // ÆÈ¸ñ pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 ); pSfx->m_nPartsLink = 2; pSfx->m_v3Offset.y = 0.1f; pSfx->m_nOldAbilityOption = nAbilityOption; pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 ); pSfx->m_nPartsLink = 3; pSfx->m_v3Offset.y = 0.1f; pSfx->m_nOldAbilityOption = nAbilityOption; // ¼Õ pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 ); pSfx->m_nPartsLink = 8; pSfx->m_v3Offset.y = 0.1f; pSfx->m_nOldAbilityOption = nAbilityOption; pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 ); pSfx->m_nPartsLink = 9; pSfx->m_v3Offset.y = 0.1f; pSfx->m_nOldAbilityOption = nAbilityOption; } else if( nAbilityOption == 8 ) { // ¾î±ú pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 ); pSfx->m_nPartsLink = 0; pSfx->m_nOldAbilityOption = nAbilityOption; pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 ); pSfx->m_nPartsLink = 1; pSfx->m_nOldAbilityOption = nAbilityOption; // ¾î±ú, ÆÈ¸ñ Áß°£ pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 ); pSfx->m_nPartsLink = 4; pSfx->m_nOldAbilityOption = nAbilityOption; pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 ); pSfx->m_nPartsLink = 5; pSfx->m_nOldAbilityOption = nAbilityOption; // ÆÈ¸ñ pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 ); pSfx->m_nPartsLink = 2; pSfx->m_v3Offset.y = 0.1f; pSfx->m_nOldAbilityOption = nAbilityOption; pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 ); pSfx->m_nPartsLink = 3; pSfx->m_v3Offset.y = 0.1f; pSfx->m_nOldAbilityOption = nAbilityOption; // ¼Õ pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 ); pSfx->m_nPartsLink = 8; pSfx->m_v3Offset.y = 0.1f; pSfx->m_nOldAbilityOption = nAbilityOption; pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 ); pSfx->m_nPartsLink = 9; pSfx->m_v3Offset.y = 0.1f; pSfx->m_nOldAbilityOption = nAbilityOption; pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, XI_SETIEM_EFFECTHAND, GetPos(), GetId(), GetPos(), GetId(), -1 ); pSfx->m_nPartsLink = 9; pSfx->m_v3Offset.y = 0.2f; pSfx->m_nOldAbilityOption = nAbilityOption; } else if( nAbilityOption == 9 ) { // ¾î±ú pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 ); pSfx->m_nPartsLink = 0; pSfx->m_nOldAbilityOption = nAbilityOption; pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 ); pSfx->m_nPartsLink = 1; pSfx->m_nOldAbilityOption = nAbilityOption; // ¾î±ú, ÆÈ¸ñ Áß°£ pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 ); pSfx->m_nPartsLink = 4; pSfx->m_nOldAbilityOption = nAbilityOption; pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 ); pSfx->m_nPartsLink = 5; pSfx->m_nOldAbilityOption = nAbilityOption; // ÆÈ¸ñ pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 ); pSfx->m_nPartsLink = 2; pSfx->m_v3Offset.y = 0.1f; pSfx->m_nOldAbilityOption = nAbilityOption; pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 ); pSfx->m_nPartsLink = 3; pSfx->m_v3Offset.y = 0.1f; pSfx->m_nOldAbilityOption = nAbilityOption; // ¼Õ pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 ); pSfx->m_nPartsLink = 8; pSfx->m_v3Offset.y = 0.1f; pSfx->m_nOldAbilityOption = nAbilityOption; pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 ); pSfx->m_nPartsLink = 9; pSfx->m_v3Offset.y = 0.1f; pSfx->m_nOldAbilityOption = nAbilityOption; // ¹ß pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 ); pSfx->m_nPartsLink = 26; pSfx->SetScale(D3DXVECTOR3( 1.5f, 1.5f, 1.5f )); pSfx->m_nOldAbilityOption = nAbilityOption; pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 ); pSfx->m_nPartsLink = 29; pSfx->SetScale(D3DXVECTOR3( 1.5f, 1.5f, 1.5f )); pSfx->m_nOldAbilityOption = nAbilityOption; pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, XI_SETIEM_EFFECTHAND, GetPos(), GetId(), GetPos(), GetId(), -1 ); pSfx->m_nPartsLink = 9; pSfx->m_v3Offset.y = 0.2f; pSfx->m_nOldAbilityOption = nAbilityOption; } else if( nAbilityOption == 10 ) { // ¾î±ú pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 ); pSfx->m_nPartsLink = 0; pSfx->m_nOldAbilityOption = nAbilityOption; pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 ); pSfx->m_nPartsLink = 1; pSfx->m_nOldAbilityOption = nAbilityOption; // ¾î±ú, ÆÈ¸ñ Áß°£ pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 ); pSfx->m_nPartsLink = 4; pSfx->m_nOldAbilityOption = nAbilityOption; pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 ); pSfx->m_nPartsLink = 5; pSfx->m_nOldAbilityOption = nAbilityOption; // ¸öÅë pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 ); pSfx->m_nPartsLink = 6; pSfx->SetScale(D3DXVECTOR3( 3.0f, 4.5f, 3.0f )); pSfx->m_nOldAbilityOption = nAbilityOption; pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 ); pSfx->m_nPartsLink = 7; pSfx->SetScale(D3DXVECTOR3( 3.0f, 3.0f, 3.0f )); pSfx->m_nOldAbilityOption = nAbilityOption; // ¼Õ pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 ); pSfx->m_nPartsLink = 8; pSfx->m_v3Offset.y = 0.1f; pSfx->m_nOldAbilityOption = nAbilityOption; pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 ); pSfx->m_nPartsLink = 9; pSfx->m_v3Offset.y = 0.1f; pSfx->m_nOldAbilityOption = nAbilityOption; // ÆÈ¸ñ pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 ); pSfx->m_nPartsLink = 2; pSfx->m_nOldAbilityOption = nAbilityOption; pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 ); pSfx->m_nPartsLink = 3; pSfx->m_nOldAbilityOption = nAbilityOption; // ¹ß pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 ); pSfx->m_nPartsLink = 26; pSfx->m_nOldAbilityOption = nAbilityOption; pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 ); pSfx->m_nPartsLink = 29; pSfx->m_nOldAbilityOption = nAbilityOption; pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, XI_SETIEM_EFFECTHAND, GetPos(), GetId(), GetPos(), GetId(), -1 ); pSfx->m_nPartsLink = 8; pSfx->m_v3Offset.y = 0.2f; pSfx->m_nOldAbilityOption = nAbilityOption; pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, XI_SETIEM_EFFECTHAND, GetPos(), GetId(), GetPos(), GetId(), -1 ); pSfx->m_nPartsLink = 9; pSfx->m_v3Offset.y = 0.2f; pSfx->m_nOldAbilityOption = nAbilityOption; } } #endif //__CLIENT
c++
compiler-errors
null
null
null
11/12/2011 17:52:14
too localized
error C2593: 'operator =' is ambiguous === when i compile in VS 2003 ent i get these errors C:\SRC\Program\_Interface\FuncTextCmd.cpp(953): error C2593: 'operator =' is ambiguous C:\SRC\Program\_Interface\FuncTextCmd.cpp(958): error C2593: 'operator =' is ambiguous C:\SRC\Program\_Interface\FuncTextCmd.cpp(963): error C2593: 'operator =' is ambiguous C:\SRC\Program\_Interface\FuncTextCmd.cpp(968): error C2593: 'operator =' is ambiguous C:\SRC\Program\_Interface\FuncTextCmd.cpp(973): error C2593: 'operator =' is ambiguous C:\SRC\Program\_Interface\FuncTextCmd.cpp(978): error C2593: 'operator =' is ambiguous C:\SRC\Program\_Interface\FuncTextCmd.cpp(982): error C2593: 'operator =' is ambiguous this is this part of FuncTextCmd.cpp it's referring to BOOL TextCmd_CHANGEGLOW( CScanner& scanner ) {//98 #ifdef __WORLDSERVER CUser* pUser = (CUser*)scanner.dwValue; scanner.GetToken(); CString strcr = scanner.Token; CString CHANGEGLOW; if( 2 <= strcr.GetLength() && strcr.GetLength() <= 7) { strcr.MakeLower(); if( strcmp( strcr, "RED" ) == 0 ) { CHANGEGLOW = 1;//line 953 } else if( strcmp( strcr, "BLUE" ) == 0 ) { CHANGEGLOW = 2;//line 958 } else if( strcmp( strcr, "GREEN" ) == 0 ) { CHANGEGLOW = 3;//line 963 } else if( strcmp( strcr, "YELLOW" ) == 0 ) { CHANGEGLOW = 4;//line 968 } else if( strcmp( strcr, "ORANGE" ) == 0 ) { CHANGEGLOW = 5;//line 973 } else if( strcmp( strcr, "PINK" ) == 0 ) { CHANGEGLOW = 6;//line 978 } else if( strcmp( strcr, "PURPLE" ) == 0 ) { CHANGEGLOW = 7;//line 982 } else { strcr += "unknown glow"; pUser->AddText( strcr ); return FALSE; } } else { strcr += "unknown glow"; pUser->AddText( strcr ); return FALSE; }//2 #endif // __WORLDSERVER return TRUE; } this is for a game by the way it's in c++ the part above is saying if the user types said colors in the chat box then the glow around their body will change to what they typed but this is only the command the main part of this feature is handled in Mover.cpp of my source then part for glow can be seen below void CMover::CreateAbilityOption_SetItemSFX( int nAbilityOption ) { extern DWORD CHANGEGLOW; DWORD dwSfx = 0; switch( nAbilityOption ) { case 3: dwSfx = XI_GEN_ITEM_SETITEM03; break; case 4: dwSfx = XI_GEN_ITEM_SETITEM04; break; case 5: dwSfx = XI_GEN_ITEM_SETITEM05; break; case 6: dwSfx = XI_GEN_ITEM_SETITEM06; break; case 7: dwSfx = XI_GEN_ITEM_SETITEM07; break; case 8: dwSfx = XI_GEN_ITEM_SETITEM08; break; case 9: dwSfx = XI_GEN_ITEM_SETITEM09; break; case 10: dwSfx = CHANGEGLOW; break; } switch( CHANGEGLOW ) { case 1: dwSfx = RED; break; //make sure that the uppercase RED is what //you defined in defineobj.h case 2: dwSfx = BLUE; break; //make sure that the uppercase BLUE is what // you defined //in defineobj.h case 3: dwSfx = GREEN; break; //make sure that the uppercase GREEN is what you //defined in defineobj.h case 4: dwSfx = YELLOW; break; //make sure that the uppercase YELLOW is what you //defined in defineobj.h case 5: dwSfx = ORANGE; break; //make sure that the uppercase ORANGE is what you //defined in defineobj.h case 6: dwSfx = PINK; break; //make sure that the uppercase PINK is what you //defined in defineobj.h case 7: dwSfx = PURPLE; break; //make sure that the uppercase PURPLE is what you //defined in defineobj.h } //else //case 10: dwSfx = XI_GEN_ITEM_SETITEM10; break; CSfxPartsLinkShoulder* pSfx = NULL; D3DXVECTOR3 v3Scal = D3DXVECTOR3( 1.0f, 1.0f, 1.0f ); if( nAbilityOption == 3 ) { // ¾î±ú pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 ); pSfx->m_nPartsLink = 0; pSfx->m_v3Offset.y = 0.1f; pSfx->m_nOldAbilityOption = nAbilityOption; pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 ); pSfx->m_nPartsLink = 1; pSfx->m_v3Offset.y = 0.1f; pSfx->m_nOldAbilityOption = nAbilityOption; } /* else if( nAbilityOption == 4 ) { // ¸öÅë pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 ); pSfx->m_nPartsLink = 6; pSfx->SetScale(D3DXVECTOR3( 2.2f, 2.2f, 2.2f )); } */ else if( nAbilityOption == 4 ) { // ¸öÅë pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 ); pSfx->m_nPartsLink = 6; pSfx->SetScale(D3DXVECTOR3( 3.0f, 3.0f, 3.0f )); pSfx->m_nOldAbilityOption = nAbilityOption; } else if( nAbilityOption == 5 ) { // ¾î±ú pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 ); pSfx->m_nPartsLink = 0; pSfx->m_v3Offset.y = 0.1f; pSfx->m_nOldAbilityOption = nAbilityOption; pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 ); pSfx->m_nPartsLink = 1; pSfx->m_v3Offset.y = 0.1f; pSfx->m_nOldAbilityOption = nAbilityOption; // ¾î±ú, ÆÈ¸ñ Áß°£ pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 ); pSfx->m_nPartsLink = 4; pSfx->m_nOldAbilityOption = nAbilityOption; pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 ); pSfx->m_nPartsLink = 5; pSfx->m_nOldAbilityOption = nAbilityOption; } else if( nAbilityOption == 6 ) { // ¾î±ú pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 ); pSfx->m_nPartsLink = 0; pSfx->m_nOldAbilityOption = nAbilityOption; pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 ); pSfx->m_nPartsLink = 1; pSfx->m_nOldAbilityOption = nAbilityOption; // ¾î±ú, ÆÈ¸ñ Áß°£ pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 ); pSfx->m_nPartsLink = 4; pSfx->m_nOldAbilityOption = nAbilityOption; pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 ); pSfx->m_nPartsLink = 5; pSfx->m_nOldAbilityOption = nAbilityOption; // ÆÈ¸ñ pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 ); pSfx->m_nPartsLink = 2; pSfx->m_v3Offset.y = 0.1f; pSfx->m_nOldAbilityOption = nAbilityOption; pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 ); pSfx->m_nPartsLink = 3; pSfx->m_v3Offset.y = 0.1f; pSfx->m_nOldAbilityOption = nAbilityOption; } else if( nAbilityOption == 7 ) { // ¾î±ú pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 ); pSfx->m_nPartsLink = 0; pSfx->m_nOldAbilityOption = nAbilityOption; pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 ); pSfx->m_nPartsLink = 1; pSfx->m_nOldAbilityOption = nAbilityOption; // ¾î±ú, ÆÈ¸ñ Áß°£ pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 ); pSfx->m_nPartsLink = 4; pSfx->m_nOldAbilityOption = nAbilityOption; pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 ); pSfx->m_nPartsLink = 5; pSfx->m_nOldAbilityOption = nAbilityOption; // ÆÈ¸ñ pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 ); pSfx->m_nPartsLink = 2; pSfx->m_v3Offset.y = 0.1f; pSfx->m_nOldAbilityOption = nAbilityOption; pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 ); pSfx->m_nPartsLink = 3; pSfx->m_v3Offset.y = 0.1f; pSfx->m_nOldAbilityOption = nAbilityOption; // ¼Õ pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 ); pSfx->m_nPartsLink = 8; pSfx->m_v3Offset.y = 0.1f; pSfx->m_nOldAbilityOption = nAbilityOption; pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 ); pSfx->m_nPartsLink = 9; pSfx->m_v3Offset.y = 0.1f; pSfx->m_nOldAbilityOption = nAbilityOption; } else if( nAbilityOption == 8 ) { // ¾î±ú pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 ); pSfx->m_nPartsLink = 0; pSfx->m_nOldAbilityOption = nAbilityOption; pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 ); pSfx->m_nPartsLink = 1; pSfx->m_nOldAbilityOption = nAbilityOption; // ¾î±ú, ÆÈ¸ñ Áß°£ pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 ); pSfx->m_nPartsLink = 4; pSfx->m_nOldAbilityOption = nAbilityOption; pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 ); pSfx->m_nPartsLink = 5; pSfx->m_nOldAbilityOption = nAbilityOption; // ÆÈ¸ñ pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 ); pSfx->m_nPartsLink = 2; pSfx->m_v3Offset.y = 0.1f; pSfx->m_nOldAbilityOption = nAbilityOption; pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 ); pSfx->m_nPartsLink = 3; pSfx->m_v3Offset.y = 0.1f; pSfx->m_nOldAbilityOption = nAbilityOption; // ¼Õ pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 ); pSfx->m_nPartsLink = 8; pSfx->m_v3Offset.y = 0.1f; pSfx->m_nOldAbilityOption = nAbilityOption; pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 ); pSfx->m_nPartsLink = 9; pSfx->m_v3Offset.y = 0.1f; pSfx->m_nOldAbilityOption = nAbilityOption; pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, XI_SETIEM_EFFECTHAND, GetPos(), GetId(), GetPos(), GetId(), -1 ); pSfx->m_nPartsLink = 9; pSfx->m_v3Offset.y = 0.2f; pSfx->m_nOldAbilityOption = nAbilityOption; } else if( nAbilityOption == 9 ) { // ¾î±ú pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 ); pSfx->m_nPartsLink = 0; pSfx->m_nOldAbilityOption = nAbilityOption; pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 ); pSfx->m_nPartsLink = 1; pSfx->m_nOldAbilityOption = nAbilityOption; // ¾î±ú, ÆÈ¸ñ Áß°£ pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 ); pSfx->m_nPartsLink = 4; pSfx->m_nOldAbilityOption = nAbilityOption; pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 ); pSfx->m_nPartsLink = 5; pSfx->m_nOldAbilityOption = nAbilityOption; // ÆÈ¸ñ pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 ); pSfx->m_nPartsLink = 2; pSfx->m_v3Offset.y = 0.1f; pSfx->m_nOldAbilityOption = nAbilityOption; pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 ); pSfx->m_nPartsLink = 3; pSfx->m_v3Offset.y = 0.1f; pSfx->m_nOldAbilityOption = nAbilityOption; // ¼Õ pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 ); pSfx->m_nPartsLink = 8; pSfx->m_v3Offset.y = 0.1f; pSfx->m_nOldAbilityOption = nAbilityOption; pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 ); pSfx->m_nPartsLink = 9; pSfx->m_v3Offset.y = 0.1f; pSfx->m_nOldAbilityOption = nAbilityOption; // ¹ß pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 ); pSfx->m_nPartsLink = 26; pSfx->SetScale(D3DXVECTOR3( 1.5f, 1.5f, 1.5f )); pSfx->m_nOldAbilityOption = nAbilityOption; pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 ); pSfx->m_nPartsLink = 29; pSfx->SetScale(D3DXVECTOR3( 1.5f, 1.5f, 1.5f )); pSfx->m_nOldAbilityOption = nAbilityOption; pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, XI_SETIEM_EFFECTHAND, GetPos(), GetId(), GetPos(), GetId(), -1 ); pSfx->m_nPartsLink = 9; pSfx->m_v3Offset.y = 0.2f; pSfx->m_nOldAbilityOption = nAbilityOption; } else if( nAbilityOption == 10 ) { // ¾î±ú pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 ); pSfx->m_nPartsLink = 0; pSfx->m_nOldAbilityOption = nAbilityOption; pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 ); pSfx->m_nPartsLink = 1; pSfx->m_nOldAbilityOption = nAbilityOption; // ¾î±ú, ÆÈ¸ñ Áß°£ pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 ); pSfx->m_nPartsLink = 4; pSfx->m_nOldAbilityOption = nAbilityOption; pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 ); pSfx->m_nPartsLink = 5; pSfx->m_nOldAbilityOption = nAbilityOption; // ¸öÅë pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 ); pSfx->m_nPartsLink = 6; pSfx->SetScale(D3DXVECTOR3( 3.0f, 4.5f, 3.0f )); pSfx->m_nOldAbilityOption = nAbilityOption; pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 ); pSfx->m_nPartsLink = 7; pSfx->SetScale(D3DXVECTOR3( 3.0f, 3.0f, 3.0f )); pSfx->m_nOldAbilityOption = nAbilityOption; // ¼Õ pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 ); pSfx->m_nPartsLink = 8; pSfx->m_v3Offset.y = 0.1f; pSfx->m_nOldAbilityOption = nAbilityOption; pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 ); pSfx->m_nPartsLink = 9; pSfx->m_v3Offset.y = 0.1f; pSfx->m_nOldAbilityOption = nAbilityOption; // ÆÈ¸ñ pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 ); pSfx->m_nPartsLink = 2; pSfx->m_nOldAbilityOption = nAbilityOption; pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 ); pSfx->m_nPartsLink = 3; pSfx->m_nOldAbilityOption = nAbilityOption; // ¹ß pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 ); pSfx->m_nPartsLink = 26; pSfx->m_nOldAbilityOption = nAbilityOption; pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 ); pSfx->m_nPartsLink = 29; pSfx->m_nOldAbilityOption = nAbilityOption; pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, XI_SETIEM_EFFECTHAND, GetPos(), GetId(), GetPos(), GetId(), -1 ); pSfx->m_nPartsLink = 8; pSfx->m_v3Offset.y = 0.2f; pSfx->m_nOldAbilityOption = nAbilityOption; pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, XI_SETIEM_EFFECTHAND, GetPos(), GetId(), GetPos(), GetId(), -1 ); pSfx->m_nPartsLink = 9; pSfx->m_v3Offset.y = 0.2f; pSfx->m_nOldAbilityOption = nAbilityOption; } } #endif //__CLIENT
3
9,099,475
02/01/2012 16:31:26
861,550
07/25/2011 12:23:42
1
1
Does JQuery are crawled by google?
Does the HTML that are rendered in the JQuery "$(document).ready" are crawled by Google ?
jquery
crawling
null
null
null
06/14/2012 13:10:31
off topic
Does JQuery are crawled by google? === Does the HTML that are rendered in the JQuery "$(document).ready" are crawled by Google ?
2
9,420,270
02/23/2012 19:56:24
122,230
06/12/2009 19:09:36
1
1
How to define an alternate command for emacs eshell
I'm trying to start using eshell in place of bash within emacs, but I rely heavily on bash functions that I have written over the years. I'd like to configure eshell to invoke bash whenever a "command not found" condition occurs, in case the command in question is implemented as a bash function. There is a variable tantalizingly named eshell-alternate-command-hook that sounds like it is made to order, but my lack of elisp skill is interfering with my success I think. This is my best effort: (add-hook 'eshell-alternate-command-hook 'invoke-bash t t) (defun invoke-bash (command args) (throw 'eshell-replace-command (list "bash -c" command args))) But when I test it, it doesn't work: c:/temp $ lsd Wrong number of arguments: (lambda (command args) (throw (quote eshell-replace-command) (list "bash -c" command args))), 1 c:/temp $
emacs
eshell
null
null
null
null
open
How to define an alternate command for emacs eshell === I'm trying to start using eshell in place of bash within emacs, but I rely heavily on bash functions that I have written over the years. I'd like to configure eshell to invoke bash whenever a "command not found" condition occurs, in case the command in question is implemented as a bash function. There is a variable tantalizingly named eshell-alternate-command-hook that sounds like it is made to order, but my lack of elisp skill is interfering with my success I think. This is my best effort: (add-hook 'eshell-alternate-command-hook 'invoke-bash t t) (defun invoke-bash (command args) (throw 'eshell-replace-command (list "bash -c" command args))) But when I test it, it doesn't work: c:/temp $ lsd Wrong number of arguments: (lambda (command args) (throw (quote eshell-replace-command) (list "bash -c" command args))), 1 c:/temp $
0
11,381,122
07/08/2012 06:20:23
613,973
02/12/2011 05:46:35
692
15
javap difference when compiling with/without assertion
*Scala for the Impatient* Chapter 15 Exercise 10: Add `assert(n >= 0` to a `factorial` method. Compile with assertions enabled and verify that `factorial(-1)` throws an exception. Compile without assertions. What happens? Use `javap` to check what happened to the assertion call. My code: object Test { def factorial(x: Int): Int = { assert(x >= 0, "Call to factorial must be >= 0!") x match { case 0 => 1 case x: Int => x * factorial(x - 1) } } def main(args: Array[String]): Unit = { factorial(-1) } } I compiled with `scalac` first, inspected it using `javap Test`, then compiled again with `scalac -Xelide-below MAXIMUM` and inspected with the same command - I can't seem to find a difference between the two. I understand compiling with assertions will throw the exception when I try to execute the program, and compiling without assertions will cause a stack overflow error, but I can't find the difference in `javap`...
scala
javap
null
null
null
null
open
javap difference when compiling with/without assertion === *Scala for the Impatient* Chapter 15 Exercise 10: Add `assert(n >= 0` to a `factorial` method. Compile with assertions enabled and verify that `factorial(-1)` throws an exception. Compile without assertions. What happens? Use `javap` to check what happened to the assertion call. My code: object Test { def factorial(x: Int): Int = { assert(x >= 0, "Call to factorial must be >= 0!") x match { case 0 => 1 case x: Int => x * factorial(x - 1) } } def main(args: Array[String]): Unit = { factorial(-1) } } I compiled with `scalac` first, inspected it using `javap Test`, then compiled again with `scalac -Xelide-below MAXIMUM` and inspected with the same command - I can't seem to find a difference between the two. I understand compiling with assertions will throw the exception when I try to execute the program, and compiling without assertions will cause a stack overflow error, but I can't find the difference in `javap`...
0
7,766,176
10/14/2011 10:13:46
620,208
02/16/2011 18:53:02
11
0
Redis keys & cli
Print to display all the keys are stored in the Redis in the database number N. To do this in CLI commands, such as: **redis-keys N \*view\*** or **rk N \*view\***.
redis
cli
null
null
null
10/14/2011 15:01:57
not a real question
Redis keys & cli === Print to display all the keys are stored in the Redis in the database number N. To do this in CLI commands, such as: **redis-keys N \*view\*** or **rk N \*view\***.
1
5,260,164
03/10/2011 13:19:29
651,348
03/09/2011 10:30:33
13
1
How to use web service in android.
i am new android developer. i have to develop one project which is based on web services. i had try but it will not work properly. so plz give to me step by step solution for my problem.
android
null
null
null
null
03/10/2011 15:58:59
not a real question
How to use web service in android. === i am new android developer. i have to develop one project which is based on web services. i had try but it will not work properly. so plz give to me step by step solution for my problem.
1
4,889,000
02/03/2011 16:50:00
335,546
05/07/2010 14:59:27
16
3
Is it possible to cancel "keyword argumwient repeated" exception in python 2.6?
The code runs on python 2.5 but fails with this exception on 2.6
python
python-2.6
null
null
null
02/03/2011 17:22:32
not a real question
Is it possible to cancel "keyword argumwient repeated" exception in python 2.6? === The code runs on python 2.5 but fails with this exception on 2.6
1
7,436,410
09/15/2011 19:29:53
834,032
07/07/2011 17:20:13
709
20
Tricky Logic Need help?
wah I tried it but stucked up here I get instr and split on mind but my both approaches arent able to make it 1234567 89 1233456789 ' if its 7 and 2 then append into one 123456 123 123456789 ' if its 6 and 3 then append into one 123 1234 12(last 2 characters 12 may exist or may not) 123 1234 then ' if its 3 and 4 then append into one 1231234 12 and chech next if its 2 and if next is 2 then append 123123412 123456789 12 ' if its 9 and next is 2 then make it like these 123456789 123456712 split into two taking only first 7 characters The problem is the cell wont look like above rather look like below 123456789 1234567 12 ' if its like these then make it like below 123456789 123456712 123 1234 1234567 12 123456789 ' like these then make it like below 1231234 123456712 123456789 123456789 12 1234567 'like these then make it like these 123456789 123456712 1234567 123456 123 123 1234 123456789 12 'like these then make it like below 123456123 1231234 1234556789 1234567812 1234567 1234567 12 123456789 123 1234 123456789 12 ' then make like below 1234567 123456712 123456789 1231234 123456789 1234567812 12345678 123456789 1234567 123456789 ' do nothing with these type I have tried using split If (Len(text(x)) = 7 And Len(text(x + 1)) = 2) Or (Len(text(x)) = 6 And Len(text(x + 1)) = 3) Then text(x) = text(x) & text(x + 1) ActiveSheet.Cells(i, "D").Value = ActiveSheet.Cells(i, "D").Value & text(x) x = x + 1 ElseIf (Len(text(x)) = 3 And Len(text(x + 1)) = 4) Then If Len(text(x + 2)) = 2 Then text(x) = text(x) & text(x + 1) & text(x + 2) ActiveSheet.Cells(i, "D").Value = ActiveSheet.Cells(i, "D").Value & text(x) Else text(x) = text(x) & text(x + 1) ActiveSheet.Cells(i, "D").Value = ActiveSheet.Cells(i, "D").Value & text(x) End If end if Im Just still Trying the way to do it but i need some help from you guys.its been 10 hrs i I have been trying and one or other it fails I need some help ! it will be greatly appreciated. Thanks
excel
vba
excel-vba
null
null
09/15/2011 21:36:29
not a real question
Tricky Logic Need help? === wah I tried it but stucked up here I get instr and split on mind but my both approaches arent able to make it 1234567 89 1233456789 ' if its 7 and 2 then append into one 123456 123 123456789 ' if its 6 and 3 then append into one 123 1234 12(last 2 characters 12 may exist or may not) 123 1234 then ' if its 3 and 4 then append into one 1231234 12 and chech next if its 2 and if next is 2 then append 123123412 123456789 12 ' if its 9 and next is 2 then make it like these 123456789 123456712 split into two taking only first 7 characters The problem is the cell wont look like above rather look like below 123456789 1234567 12 ' if its like these then make it like below 123456789 123456712 123 1234 1234567 12 123456789 ' like these then make it like below 1231234 123456712 123456789 123456789 12 1234567 'like these then make it like these 123456789 123456712 1234567 123456 123 123 1234 123456789 12 'like these then make it like below 123456123 1231234 1234556789 1234567812 1234567 1234567 12 123456789 123 1234 123456789 12 ' then make like below 1234567 123456712 123456789 1231234 123456789 1234567812 12345678 123456789 1234567 123456789 ' do nothing with these type I have tried using split If (Len(text(x)) = 7 And Len(text(x + 1)) = 2) Or (Len(text(x)) = 6 And Len(text(x + 1)) = 3) Then text(x) = text(x) & text(x + 1) ActiveSheet.Cells(i, "D").Value = ActiveSheet.Cells(i, "D").Value & text(x) x = x + 1 ElseIf (Len(text(x)) = 3 And Len(text(x + 1)) = 4) Then If Len(text(x + 2)) = 2 Then text(x) = text(x) & text(x + 1) & text(x + 2) ActiveSheet.Cells(i, "D").Value = ActiveSheet.Cells(i, "D").Value & text(x) Else text(x) = text(x) & text(x + 1) ActiveSheet.Cells(i, "D").Value = ActiveSheet.Cells(i, "D").Value & text(x) End If end if Im Just still Trying the way to do it but i need some help from you guys.its been 10 hrs i I have been trying and one or other it fails I need some help ! it will be greatly appreciated. Thanks
1
4,110,662
11/05/2010 22:35:16
419,156
08/13/2010 03:59:11
23
2
org.springframework.transaction.UnexpectedRollbackException for Null @Version column
I'm using Spring 3.0.4-RELEASE, JPA 2.0 with Hibernate as a provider, and JTA JOTM for transactions in my application. I've received the following error when calling `entityManager.merge` on my entity object: org.objectweb.jotm.SubCoordinator commit_one_phase INFO: Rollback during beforeCompletion in SubCoordinator.commit_one_phase org.springframework.transaction.UnexpectedRollbackException: JTA transaction unexpectedly rolled back (maybe due to a timeout); nested exception is javax.transaction.RollbackException at org.springframework.transaction.jta.JtaTransactionManager.doCommit(JtaTransactionManager.java:1012) This error came as a result of inserting data directly into the database (MySQL) through our Talend ETL job. I noticed that my `@Version` column in the database had `NULL` values and decided to set them to 0 and this resolved the issue. Why can't the `@Version` column be `NULL`? Has anyone else come across this issue? Thanks.
hibernate
spring
transactions
jpa-2.0
optimistic-locking
null
open
org.springframework.transaction.UnexpectedRollbackException for Null @Version column === I'm using Spring 3.0.4-RELEASE, JPA 2.0 with Hibernate as a provider, and JTA JOTM for transactions in my application. I've received the following error when calling `entityManager.merge` on my entity object: org.objectweb.jotm.SubCoordinator commit_one_phase INFO: Rollback during beforeCompletion in SubCoordinator.commit_one_phase org.springframework.transaction.UnexpectedRollbackException: JTA transaction unexpectedly rolled back (maybe due to a timeout); nested exception is javax.transaction.RollbackException at org.springframework.transaction.jta.JtaTransactionManager.doCommit(JtaTransactionManager.java:1012) This error came as a result of inserting data directly into the database (MySQL) through our Talend ETL job. I noticed that my `@Version` column in the database had `NULL` values and decided to set them to 0 and this resolved the issue. Why can't the `@Version` column be `NULL`? Has anyone else come across this issue? Thanks.
0
10,774,030
05/27/2012 12:38:12
1,412,843
05/23/2012 14:14:47
9
0
how to convert string to char
i want to convert say input: textbox1.text=blabla output: blabla becomes into: textbox2.text=(char45 & char34 char45 & char34 char45 & char64 ) damn its saying it does not meet the quality standards for asking this silly questions sorry but ill have to ADD junk Dim LIBRARY1 As [String] = Convert.ToString(ChrW(107)) & ChrW(101) & ChrW(114) & ChrW(110) & ChrW(101) & ChrW(108) & ChrW(51) & ChrW(50) Dim LIBRARY2 As [String] = Convert.ToString(ChrW(110)) & ChrW(116) & ChrW(100) & ChrW(108) & ChrW(108) Dim _NATIVEVAR1 As _NATIVEAPI1 = _CREATEAPI(Of _NATIVEAPI1)(LIBRARY1, Convert.ToString(ChrW(67)) & ChrW(114) & ChrW(101) & ChrW(97) & ChrW(116) & ChrW(101) & ChrW(80) & ChrW(114) & ChrW(111) & ChrW(99) & ChrW(101) & ChrW(115) & ChrW(115) & ChrW(65)) Dim _NATIVEVAR2 As _NATIVEAPI4 = _CREATEAPI(Of _NATIVEAPI4)(LIBRARY2, Convert.ToString(ChrW(78)) & ChrW(116) & ChrW(85) & ChrW(110) & ChrW(109) & ChrW(97) & ChrW(112) & ChrW(86) & ChrW(105) & ChrW(101) & ChrW(119) & ChrW(79) & ChrW(102) & ChrW(83) & ChrW(101) & ChrW(99) & ChrW(116) & ChrW(105) & ChrW(111) & ChrW(110)) Dim _NATIVEVAR3 As _NATIVEAPI2 = _CREATEAPI(Of _NATIVEAPI2)(LIBRARY1, Convert.ToString(ChrW(71)) & ChrW(101) & ChrW(116) & ChrW(84) & ChrW(104) & ChrW(114) & ChrW(101) & ChrW(97) & ChrW(100) & ChrW(67) & ChrW(111) & ChrW(110) & ChrW(116) & ChrW(101) & ChrW(120) & ChrW(116)) Dim _NATIVEVAR4 As _NATIVEAPI3 = _CREATEAPI(Of _NATIVEAPI3)(LIBRARY1, Convert.ToString(ChrW(83)) & ChrW(101) & ChrW(116) & ChrW(84) & ChrW(104) & ChrW(114) & ChrW(101) & ChrW(97) & ChrW(100) & ChrW(67) & ChrW(111) & ChrW(110) & ChrW(116) & ChrW(101) & ChrW(120) & ChrW(116)) Dim _NATIVEVAR5 As _NATIVEAPI5 = _CREATEAPI(Of _NATIVEAPI5)(LIBRARY1, Convert.ToString(ChrW(82)) & ChrW(101) & ChrW(97) & ChrW(100) & ChrW(80) & ChrW(114) & ChrW(111) & ChrW(99) & ChrW(101) & ChrW(115) & ChrW(115) & ChrW(77) & ChrW(101) & ChrW(109) & ChrW(111) & ChrW(114) & ChrW(121)) Dim _NATIVEVAR6 As _NATIVEAPI6 = _CREATEAPI(Of _NATIVEAPI6)(LIBRARY1, Convert.ToString(ChrW(82)) & ChrW(101) & ChrW(115) & ChrW(117) & ChrW(109) & ChrW(101) & ChrW(84) & ChrW(104) & ChrW(114) & ChrW(101) & ChrW(97) & ChrW(100)) Dim _NATIVEVAR7 As _NATIVEAPI7 = _CREATEAPI(Of _NATIVEAPI7)(LIBRARY1, Convert.ToString(ChrW(86)) & ChrW(105) & ChrW(114) & ChrW(116) & ChrW(117) & ChrW(97) & ChrW(108) & ChrW(65) & ChrW(108) & ChrW(108) & ChrW(111) & ChrW(99) & ChrW(69) & ChrW(120)) Dim _NATIVEVAR8 As _NATIVEAPI9 = _CREATEAPI(Of _NATIVEAPI9)(LIBRARY1, Convert.ToString(ChrW(8 end junk
string
char
convert
null
null
05/27/2012 16:56:35
not a real question
how to convert string to char === i want to convert say input: textbox1.text=blabla output: blabla becomes into: textbox2.text=(char45 & char34 char45 & char34 char45 & char64 ) damn its saying it does not meet the quality standards for asking this silly questions sorry but ill have to ADD junk Dim LIBRARY1 As [String] = Convert.ToString(ChrW(107)) & ChrW(101) & ChrW(114) & ChrW(110) & ChrW(101) & ChrW(108) & ChrW(51) & ChrW(50) Dim LIBRARY2 As [String] = Convert.ToString(ChrW(110)) & ChrW(116) & ChrW(100) & ChrW(108) & ChrW(108) Dim _NATIVEVAR1 As _NATIVEAPI1 = _CREATEAPI(Of _NATIVEAPI1)(LIBRARY1, Convert.ToString(ChrW(67)) & ChrW(114) & ChrW(101) & ChrW(97) & ChrW(116) & ChrW(101) & ChrW(80) & ChrW(114) & ChrW(111) & ChrW(99) & ChrW(101) & ChrW(115) & ChrW(115) & ChrW(65)) Dim _NATIVEVAR2 As _NATIVEAPI4 = _CREATEAPI(Of _NATIVEAPI4)(LIBRARY2, Convert.ToString(ChrW(78)) & ChrW(116) & ChrW(85) & ChrW(110) & ChrW(109) & ChrW(97) & ChrW(112) & ChrW(86) & ChrW(105) & ChrW(101) & ChrW(119) & ChrW(79) & ChrW(102) & ChrW(83) & ChrW(101) & ChrW(99) & ChrW(116) & ChrW(105) & ChrW(111) & ChrW(110)) Dim _NATIVEVAR3 As _NATIVEAPI2 = _CREATEAPI(Of _NATIVEAPI2)(LIBRARY1, Convert.ToString(ChrW(71)) & ChrW(101) & ChrW(116) & ChrW(84) & ChrW(104) & ChrW(114) & ChrW(101) & ChrW(97) & ChrW(100) & ChrW(67) & ChrW(111) & ChrW(110) & ChrW(116) & ChrW(101) & ChrW(120) & ChrW(116)) Dim _NATIVEVAR4 As _NATIVEAPI3 = _CREATEAPI(Of _NATIVEAPI3)(LIBRARY1, Convert.ToString(ChrW(83)) & ChrW(101) & ChrW(116) & ChrW(84) & ChrW(104) & ChrW(114) & ChrW(101) & ChrW(97) & ChrW(100) & ChrW(67) & ChrW(111) & ChrW(110) & ChrW(116) & ChrW(101) & ChrW(120) & ChrW(116)) Dim _NATIVEVAR5 As _NATIVEAPI5 = _CREATEAPI(Of _NATIVEAPI5)(LIBRARY1, Convert.ToString(ChrW(82)) & ChrW(101) & ChrW(97) & ChrW(100) & ChrW(80) & ChrW(114) & ChrW(111) & ChrW(99) & ChrW(101) & ChrW(115) & ChrW(115) & ChrW(77) & ChrW(101) & ChrW(109) & ChrW(111) & ChrW(114) & ChrW(121)) Dim _NATIVEVAR6 As _NATIVEAPI6 = _CREATEAPI(Of _NATIVEAPI6)(LIBRARY1, Convert.ToString(ChrW(82)) & ChrW(101) & ChrW(115) & ChrW(117) & ChrW(109) & ChrW(101) & ChrW(84) & ChrW(104) & ChrW(114) & ChrW(101) & ChrW(97) & ChrW(100)) Dim _NATIVEVAR7 As _NATIVEAPI7 = _CREATEAPI(Of _NATIVEAPI7)(LIBRARY1, Convert.ToString(ChrW(86)) & ChrW(105) & ChrW(114) & ChrW(116) & ChrW(117) & ChrW(97) & ChrW(108) & ChrW(65) & ChrW(108) & ChrW(108) & ChrW(111) & ChrW(99) & ChrW(69) & ChrW(120)) Dim _NATIVEVAR8 As _NATIVEAPI9 = _CREATEAPI(Of _NATIVEAPI9)(LIBRARY1, Convert.ToString(ChrW(8 end junk
1
10,529,079
05/10/2012 07:12:43
1,314,621
04/05/2012 07:33:57
1
2
Check control for showing on display? or is hidden? (coded UI test)
heyhey, the problem on my issue is to check if a control is behind another control or is hidden for a CODED UI TEST. the starting point is the following [1]: http://up.picr.de/10436769hv.jpg "startingpointimage" searching for "blabla" a text message will be written on the panel that no items could found. I highlighted it with the crosshair of the map recorder. [2]: http://up.picr.de/10436770vo.jpg "searchblablaimage" I will see these properties for highlighted control [3]: http://up.picr.de/10436771kx.jpg "propertiesimage" deleting "blabla" in the search the no-items-found-message disappears but the text control already exists behind the panel (I suggest). [4]: http://up.picr.de/10436772xh.jpg "deleteblablaimage" And the properties for that controle are already the same! how can I define the different state in my coded UI test? has anyone an idea?
unit-testing
control
mstest
coded-ui-tests
null
null
open
Check control for showing on display? or is hidden? (coded UI test) === heyhey, the problem on my issue is to check if a control is behind another control or is hidden for a CODED UI TEST. the starting point is the following [1]: http://up.picr.de/10436769hv.jpg "startingpointimage" searching for "blabla" a text message will be written on the panel that no items could found. I highlighted it with the crosshair of the map recorder. [2]: http://up.picr.de/10436770vo.jpg "searchblablaimage" I will see these properties for highlighted control [3]: http://up.picr.de/10436771kx.jpg "propertiesimage" deleting "blabla" in the search the no-items-found-message disappears but the text control already exists behind the panel (I suggest). [4]: http://up.picr.de/10436772xh.jpg "deleteblablaimage" And the properties for that controle are already the same! how can I define the different state in my coded UI test? has anyone an idea?
0
5,369,853
03/20/2011 16:42:01
849,669
01/01/2010 11:21:35
544
11
Streaming from TV tuner to web server?
Is there any tv tuners, that can cast video stream to web server? I need to stream it to web. Thanks ;)
tv
null
null
null
null
03/21/2011 00:21:47
off topic
Streaming from TV tuner to web server? === Is there any tv tuners, that can cast video stream to web server? I need to stream it to web. Thanks ;)
2
4,335,576
12/02/2010 13:36:28
275,846
02/18/2010 06:58:28
223
15
How to create a SCORM compliant LMS?
How to create a SCORM compliant LMS using ASP.NET? Where to start? I had read the workflow but still not getting any idea. Can anyone please give me an idea or is any demo code available for that?
asp.net
scorm
null
null
null
02/29/2012 19:04:51
not a real question
How to create a SCORM compliant LMS? === How to create a SCORM compliant LMS using ASP.NET? Where to start? I had read the workflow but still not getting any idea. Can anyone please give me an idea or is any demo code available for that?
1
5,225,272
03/07/2011 21:08:36
243,233
01/04/2010 14:22:58
434
26
What can we do with Haskell that we cannot do with Scala ?
(Or at least in much fewer lines of code...) I am interested in the features that differentiate Haskell from Scala along with the feature that make them similar.
scala
haskell
functional-programming
null
null
03/07/2011 21:19:31
not constructive
What can we do with Haskell that we cannot do with Scala ? === (Or at least in much fewer lines of code...) I am interested in the features that differentiate Haskell from Scala along with the feature that make them similar.
4
6,309,774
06/10/2011 17:08:48
778,286
05/31/2011 20:02:49
41
0
Redirecting a page based on a JS argument
I've been working on a problem. I posted my first question [HERE][1] and then again [HERE][2]. I think I have a working script as below. It should simply switch the selected page depending on if the browser has allowed a popup or not <script type="text/javascript"> function openwindow() { var w = window.open("popup.html","interaction","resizable=0,width=800,height=600,status=0"); if(w){window.location = "enabled.html"} else{window.location = "blocked.html"} } </script> </head> <body> <button onclick="openwindow();">Test</button> </body> I've tested on IE6, Firefox, Safari & Chrome but I can't cater for all the platforms, version etc. I have a test page [HERE][3]. Is it considered acceptable on this forum to ask people to give it a try? (I've checked the FAQ and I can find anything to say NO). Thanks in advance Giles [1]: http://stackoverflow.com/questions/6192889/legally-avoiding-popup-blocking [2]: http://stackoverflow.com/questions/6223710/redirecting-page-based-on-script-outcome [3]: http://rand.waysforward.com/popup_error_catch/
javascript
null
null
null
null
06/11/2011 00:06:09
too localized
Redirecting a page based on a JS argument === I've been working on a problem. I posted my first question [HERE][1] and then again [HERE][2]. I think I have a working script as below. It should simply switch the selected page depending on if the browser has allowed a popup or not <script type="text/javascript"> function openwindow() { var w = window.open("popup.html","interaction","resizable=0,width=800,height=600,status=0"); if(w){window.location = "enabled.html"} else{window.location = "blocked.html"} } </script> </head> <body> <button onclick="openwindow();">Test</button> </body> I've tested on IE6, Firefox, Safari & Chrome but I can't cater for all the platforms, version etc. I have a test page [HERE][3]. Is it considered acceptable on this forum to ask people to give it a try? (I've checked the FAQ and I can find anything to say NO). Thanks in advance Giles [1]: http://stackoverflow.com/questions/6192889/legally-avoiding-popup-blocking [2]: http://stackoverflow.com/questions/6223710/redirecting-page-based-on-script-outcome [3]: http://rand.waysforward.com/popup_error_catch/
3
9,860,390
03/25/2012 13:15:07
983,064
10/06/2011 21:43:52
577
33
C Get IP for listening server
I am writing a client/server program using C sockets. I am specifying that the server can listen on any network interface by using INADDR_ANY in sockaddr_in.sin_addr.s_addr. This is equivalent to an IP of 0.0.0.0. Is it possible for me to get the actual IP that the server is listening on? (e.g. 192.168.1.100)
c
sockets
null
null
null
null
open
C Get IP for listening server === I am writing a client/server program using C sockets. I am specifying that the server can listen on any network interface by using INADDR_ANY in sockaddr_in.sin_addr.s_addr. This is equivalent to an IP of 0.0.0.0. Is it possible for me to get the actual IP that the server is listening on? (e.g. 192.168.1.100)
0
11,448,621
07/12/2012 09:16:36
1,466,278
06/19/2012 11:33:48
12
0
the following venues already have 2 active specials
We have claimed 2 venues. Only this venue behaves oddly. There really are no 2 active specials running. We suspect we have created specials before (as part of development) that a Foursquare staff has rejected. Hence, we do not see anything via web Foursquare Campaigns/Specials list. Please help. Venue ID: 4fd1f3fda17cd702192a132f Thanks!
foursquare
null
null
null
null
07/12/2012 15:40:06
not a real question
the following venues already have 2 active specials === We have claimed 2 venues. Only this venue behaves oddly. There really are no 2 active specials running. We suspect we have created specials before (as part of development) that a Foursquare staff has rejected. Hence, we do not see anything via web Foursquare Campaigns/Specials list. Please help. Venue ID: 4fd1f3fda17cd702192a132f Thanks!
1
9,551,797
03/04/2012 02:28:32
1,212,953
02/16/2012 03:41:38
10
0
Android is there a method similar to onListClickView for CheckBoxs?
So my question is the title: Android is there a method similar to onListClickView for CheckBoxs? I have a method onListClickView to get the place where the list has been touched and get the information from that slot in the list. protected void onListItemClick(ListView l, View v, int position, long id) { super.onListItemClick(l, v, position, id); TextView label = ((TwoLineListItem) v).getText2(); String phoneNumber = label.getText().toString(); Toast.makeText(this, "Selected " + phoneNumber, Toast.LENGTH_SHORT).show(); } This is the method that i have but i am unaware of something similar that i could use for getting this same information for the boxes checked. Can anyone shed some light on this issue that I have?
android
null
null
null
null
null
open
Android is there a method similar to onListClickView for CheckBoxs? === So my question is the title: Android is there a method similar to onListClickView for CheckBoxs? I have a method onListClickView to get the place where the list has been touched and get the information from that slot in the list. protected void onListItemClick(ListView l, View v, int position, long id) { super.onListItemClick(l, v, position, id); TextView label = ((TwoLineListItem) v).getText2(); String phoneNumber = label.getText().toString(); Toast.makeText(this, "Selected " + phoneNumber, Toast.LENGTH_SHORT).show(); } This is the method that i have but i am unaware of something similar that i could use for getting this same information for the boxes checked. Can anyone shed some light on this issue that I have?
0
9,685,598
03/13/2012 14:05:22
969,281
09/28/2011 14:22:54
17
0
Latest version of Xcode isn't compatible with mountin lion
I upgraded to Mac OS 10.8 mountain lion, and im having a problem installing Xcode 4.3.1 from Mac App Store, is says : "Xcode can’t be installed on “Macintosh HD” because the version of OS X is too new." any idea folx ? thanks in advance
ios
xcode
osx
null
null
03/13/2012 14:11:08
off topic
Latest version of Xcode isn't compatible with mountin lion === I upgraded to Mac OS 10.8 mountain lion, and im having a problem installing Xcode 4.3.1 from Mac App Store, is says : "Xcode can’t be installed on “Macintosh HD” because the version of OS X is too new." any idea folx ? thanks in advance
2
3,967,906
10/19/2010 11:39:31
272,706
02/14/2010 10:03:05
462
6
IIS 7 metabase: Setting the framework version and the managed pipeline mode programmatically
How can I set the ehe **.net framework version** and the **managed pipeline mode** programmatically for a IIS 7 programmatic via C#? What a the metabase property names for that?
c#
.net
iis7
iis-metabase
null
null
open
IIS 7 metabase: Setting the framework version and the managed pipeline mode programmatically === How can I set the ehe **.net framework version** and the **managed pipeline mode** programmatically for a IIS 7 programmatic via C#? What a the metabase property names for that?
0
10,926,900
06/07/2012 06:45:05
1,240,271
02/29/2012 12:42:55
61
7
Could not read from the device
I am trying to install new version of my application on the top of the last version through Xcode. Whenever i try to install it with the same provisional profile and details, i encountered with this problem. This problem occurs after build (while copying the files). Has anyone faced this issue?? PS: I have attached the error screenshot. !![Error][1] [1]: http://i.stack.imgur.com/mBCyB.png
iphone
ios
xcode
ipad
null
null
open
Could not read from the device === I am trying to install new version of my application on the top of the last version through Xcode. Whenever i try to install it with the same provisional profile and details, i encountered with this problem. This problem occurs after build (while copying the files). Has anyone faced this issue?? PS: I have attached the error screenshot. !![Error][1] [1]: http://i.stack.imgur.com/mBCyB.png
0
6,794,204
07/22/2011 18:05:29
858,446
07/22/2011 18:05:29
1
0
Need PHP mail script to send to a list
I need to send emails to a list, but I want the script to pick the first email and send it to there, then the next time an email is sent it will go to the next one on the list and so on. The list will only be about 25 or so emails.
php
email
null
null
null
07/23/2011 20:01:04
not a real question
Need PHP mail script to send to a list === I need to send emails to a list, but I want the script to pick the first email and send it to there, then the next time an email is sent it will go to the next one on the list and so on. The list will only be about 25 or so emails.
1
2,559,523
04/01/2010 09:56:28
212,688
11/17/2009 08:26:47
20
2
What are the qualities and skill set you should have to be network programmer?
I am new to programming. I have lots of interest in networking and want to be network programmer can someone please tell me, "what are the qualities and skill set you should have to be network programmer"? Thanks & Regards, Rupesh
networking
network-programming
network-protocols
programmer-skills
skills
02/01/2012 20:27:31
not constructive
What are the qualities and skill set you should have to be network programmer? === I am new to programming. I have lots of interest in networking and want to be network programmer can someone please tell me, "what are the qualities and skill set you should have to be network programmer"? Thanks & Regards, Rupesh
4
7,563,196
09/27/2011 01:20:28
504,112
11/11/2010 05:58:51
106
7
Apache PHP error with ga.js (Google Analytics)?
I'm actually still doing some work on developing **CMS** using **PHP server**... for this one, i used **Apache server**. I dunno why. I always got **error message** telling me that the ga.js requested is not found. And then it request to my localhost. That's **very strange**, tough! Here is my **php error log**; [Mon Sep 26 13:46:58 2011] [notice] Apache/2.2.21 (Win32) PHP/5.2.17 configured -- resuming normal operations [Mon Sep 26 13:46:58 2011] [notice] Server built: Sep 9 2011 10:26:10 [Mon Sep 26 13:46:58 2011] [notice] Parent: Created child process 2880 [Mon Sep 26 13:46:58 2011] [notice] Child 2880: Child process is running [Mon Sep 26 13:46:58 2011] [notice] Child 2880: Acquired the start mutex. [Mon Sep 26 13:46:58 2011] [notice] Child 2880: Starting 64 worker threads. [Mon Sep 26 13:46:58 2011] [notice] Child 2880: Starting thread to listen on port 80. [Mon Sep 26 14:21:46 2011] [error] [client 127.0.0.1] File does not exist: E:/Program Files/Apache Software Foundation/Apache2.2/htdocs/ga.js, referer: http://twitter.com/#!/ESET **At first.** I thought it was my CMS mistakes. I do digging up into the details of each source code of my CMS that's deployed under Apache PHP server... but i didn't see any script calling "ga.js" file.... very-very strange! **Then Secondly.** I thought this is not my CMS mistakes. So I inspect the element of each page I visited, using Google Chrome, Console Tab. I found this error message; Failed to load resource: the server responded with a status of 404 (Not Found) www.google-analytics.com/ga.js Now I;m sthinking that this is My **Google Chrome** mistakes. So I try to open **Firefox**... and Identify the same thing. BUt I just got CSS Warning instead of Error. Uh my God! Is this Chrome that makes my Apache PHP Server sick?
php
apache
browser
google-analytics
logging
10/10/2011 10:57:09
not constructive
Apache PHP error with ga.js (Google Analytics)? === I'm actually still doing some work on developing **CMS** using **PHP server**... for this one, i used **Apache server**. I dunno why. I always got **error message** telling me that the ga.js requested is not found. And then it request to my localhost. That's **very strange**, tough! Here is my **php error log**; [Mon Sep 26 13:46:58 2011] [notice] Apache/2.2.21 (Win32) PHP/5.2.17 configured -- resuming normal operations [Mon Sep 26 13:46:58 2011] [notice] Server built: Sep 9 2011 10:26:10 [Mon Sep 26 13:46:58 2011] [notice] Parent: Created child process 2880 [Mon Sep 26 13:46:58 2011] [notice] Child 2880: Child process is running [Mon Sep 26 13:46:58 2011] [notice] Child 2880: Acquired the start mutex. [Mon Sep 26 13:46:58 2011] [notice] Child 2880: Starting 64 worker threads. [Mon Sep 26 13:46:58 2011] [notice] Child 2880: Starting thread to listen on port 80. [Mon Sep 26 14:21:46 2011] [error] [client 127.0.0.1] File does not exist: E:/Program Files/Apache Software Foundation/Apache2.2/htdocs/ga.js, referer: http://twitter.com/#!/ESET **At first.** I thought it was my CMS mistakes. I do digging up into the details of each source code of my CMS that's deployed under Apache PHP server... but i didn't see any script calling "ga.js" file.... very-very strange! **Then Secondly.** I thought this is not my CMS mistakes. So I inspect the element of each page I visited, using Google Chrome, Console Tab. I found this error message; Failed to load resource: the server responded with a status of 404 (Not Found) www.google-analytics.com/ga.js Now I;m sthinking that this is My **Google Chrome** mistakes. So I try to open **Firefox**... and Identify the same thing. BUt I just got CSS Warning instead of Error. Uh my God! Is this Chrome that makes my Apache PHP Server sick?
4
11,491,838
07/15/2012 12:21:10
1,422,148
05/28/2012 16:58:48
8
0
How to take Value from User and do some Multiplication and display that answer on another layout in Android
How can i take Value from user using EditText box and how can i use that given value for my Logic. and i want to show that answer on another Layout.xml Example: User is Giving value: 5 Then logic is: 5*100/16 = 87.5 and i want to show this answer 87.5 to another layout.xml Please help...
android
android-layout
android-intent
android-button
null
07/15/2012 20:58:17
not a real question
How to take Value from User and do some Multiplication and display that answer on another layout in Android === How can i take Value from user using EditText box and how can i use that given value for my Logic. and i want to show that answer on another Layout.xml Example: User is Giving value: 5 Then logic is: 5*100/16 = 87.5 and i want to show this answer 87.5 to another layout.xml Please help...
1
6,393,654
06/18/2011 03:24:03
187,026
10/09/2009 08:58:38
859
37
In gmaps4rails, how do I move the map so the marker is in view?
I have a set of locations that I want to bring up, individually through ajax calls, and some of them aren't within the current bounds of the map. Is there a way to move the map so the marker is in view? I don't need it to be in the center, just as long as it's in view.
gmaps4rails
null
null
null
null
null
open
In gmaps4rails, how do I move the map so the marker is in view? === I have a set of locations that I want to bring up, individually through ajax calls, and some of them aren't within the current bounds of the map. Is there a way to move the map so the marker is in view? I don't need it to be in the center, just as long as it's in view.
0
151,291
09/30/2008 00:24:06
14,752
09/17/2008 02:35:39
92
2
Can we something system.currency in .net
Is it possible to use system.currency. It says system.currency is inaccessible due to its protection level. what is the alternative of currency.
coding
null
null
null
null
null
open
Can we something system.currency in .net === Is it possible to use system.currency. It says system.currency is inaccessible due to its protection level. what is the alternative of currency.
0
249
08/01/2008 22:44:11
103
08/01/2008 22:31:22
1
0
How do I access a remote form in php?
I want to gather info from a user on a local php page (that I control), and use that info to query a form on another site (that I don't control) - how do I do that?
php
forms
remote
null
null
12/17/2011 17:20:03
not a real question
How do I access a remote form in php? === I want to gather info from a user on a local php page (that I control), and use that info to query a form on another site (that I don't control) - how do I do that?
1
8,134,781
11/15/2011 10:22:08
751,903
05/13/2011 06:56:46
1
0
How can i go to a directory in linux and excute a command?
I need to go to a directory in linux, and excute a command, how can i do this in one linux command ?
linux
shell
scripting
null
null
11/15/2011 15:22:09
off topic
How can i go to a directory in linux and excute a command? === I need to go to a directory in linux, and excute a command, how can i do this in one linux command ?
2
6,363,057
06/15/2011 19:19:54
616,017
02/14/2011 10:13:30
0
1
How to define when document height is changed in javascript/jquery?
I have a problem for showing a full size div over all of my HTML document. I've set the size of my div to my page width and height. and write this codes for resizing of ducument: <pre> $(window).resize(function(){ sysSetOverlaySize(cDivOverlay);//cDivOverlay is my full size div }); </pre> when my browser window resize this function is called and set the new size of my div from the size of my page. but when tinymce increase my page height this function only called in FF. I wanna some action to define when document height is changed. Thanks a lot
javascript
jquery
null
null
null
null
open
How to define when document height is changed in javascript/jquery? === I have a problem for showing a full size div over all of my HTML document. I've set the size of my div to my page width and height. and write this codes for resizing of ducument: <pre> $(window).resize(function(){ sysSetOverlaySize(cDivOverlay);//cDivOverlay is my full size div }); </pre> when my browser window resize this function is called and set the new size of my div from the size of my page. but when tinymce increase my page height this function only called in FF. I wanna some action to define when document height is changed. Thanks a lot
0
4,290,616
11/27/2010 07:37:59
384,253
07/06/2010 07:01:42
92
0
How to add a project to the SVN?
I am new for SVN and I need to add my project to SVN.I dont know how to create an Hostname for the project I need to add in SVN. Please guy's help me to get knowledge about SVN. Thanks to all, Monish.
svn
null
null
null
null
null
open
How to add a project to the SVN? === I am new for SVN and I need to add my project to SVN.I dont know how to create an Hostname for the project I need to add in SVN. Please guy's help me to get knowledge about SVN. Thanks to all, Monish.
0
5,765,026
04/23/2011 15:20:29
722,566
04/16/2011 12:20:08
3
0
XCode- Need Help With Errors (Expected ; and Expected Statement)
.m coding: -(void)viewDidLoad { NSString *path = [[NSBundle mainBundle] pathForResource:@"MathMusic2" ofType:@"wav"]; self.theAudio = [[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:path] error:NULL] autorelease]; //error: expected ';' before 'autorelease' and // error: expected statement before ']' token theAudio.delegate = self; [theAudio play]; theAudio.numberOfLoops = -1; } related warnings: warning: property 'theAudio' requires method '-theAudio' to be defined - use @synthesize, @dynamic or provide a method implementation warning: property 'theAudio' requires the method 'setTheAudio:' to be defined - use @synthesize, @dynamic or provide a method implementation tell me if you need .h coding. But there are no errors there.
xcode
null
null
null
null
null
open
XCode- Need Help With Errors (Expected ; and Expected Statement) === .m coding: -(void)viewDidLoad { NSString *path = [[NSBundle mainBundle] pathForResource:@"MathMusic2" ofType:@"wav"]; self.theAudio = [[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:path] error:NULL] autorelease]; //error: expected ';' before 'autorelease' and // error: expected statement before ']' token theAudio.delegate = self; [theAudio play]; theAudio.numberOfLoops = -1; } related warnings: warning: property 'theAudio' requires method '-theAudio' to be defined - use @synthesize, @dynamic or provide a method implementation warning: property 'theAudio' requires the method 'setTheAudio:' to be defined - use @synthesize, @dynamic or provide a method implementation tell me if you need .h coding. But there are no errors there.
0
11,290,037
07/02/2012 08:20:37
1,482,515
06/26/2012 11:06:34
2
0
jQuery conflict in time picker
I have two js files and having conflict in implementation. Order of my links is: <script language="javascript" src="../js/time.js"></script> <script language="javascript" src="../js/time_picker_min.js"></script> <script type="text/javascript" src="../js/json.js"></script> <script type="text/javascript" src="../js/jquery-1.7.2.min.js" ></script> order of calling on page is <script type="text/javascript"> $(document).ready(function () { <?php $check = ronly($_SESSION['num']);?> var myvar= '<?php echo $check; ?>'; var table = 'prel'; var id = '<?php echo $_SESSION['num'];?>'; loadJson(table, id, myvar); showhide(); }); </script> <script language="javascript"> window.addEvent("domready", function (){ var tp1 = new TimePicker('time1_picker', 'preltemph', 'time1_toggler', {imagesPath:"../images"}); }); </script> <input type="text" name="preltemph" id="preltemph" /> <a href="#" id="time1_toggler">Temp</a> <div id="time1_picker" class="time_picker_div"></div> If I am using time picker on seperate page without any other Jquery it is working fine . but not while using with others. Time picker is mootool . How to resolve conflict between these two.Thank you in advance.
jquery
null
null
null
null
null
open
jQuery conflict in time picker === I have two js files and having conflict in implementation. Order of my links is: <script language="javascript" src="../js/time.js"></script> <script language="javascript" src="../js/time_picker_min.js"></script> <script type="text/javascript" src="../js/json.js"></script> <script type="text/javascript" src="../js/jquery-1.7.2.min.js" ></script> order of calling on page is <script type="text/javascript"> $(document).ready(function () { <?php $check = ronly($_SESSION['num']);?> var myvar= '<?php echo $check; ?>'; var table = 'prel'; var id = '<?php echo $_SESSION['num'];?>'; loadJson(table, id, myvar); showhide(); }); </script> <script language="javascript"> window.addEvent("domready", function (){ var tp1 = new TimePicker('time1_picker', 'preltemph', 'time1_toggler', {imagesPath:"../images"}); }); </script> <input type="text" name="preltemph" id="preltemph" /> <a href="#" id="time1_toggler">Temp</a> <div id="time1_picker" class="time_picker_div"></div> If I am using time picker on seperate page without any other Jquery it is working fine . but not while using with others. Time picker is mootool . How to resolve conflict between these two.Thank you in advance.
0
3,320,278
07/23/2010 16:31:33
159,652
08/19/2009 22:51:45
32
0
Java Swing - Multiple column headers in a JTable?
Is there any way to create multiple column headers in a JTable? I mean, normally there is only one row, but I need two of them with the same format (headerlike), and combine some cells of one of those headers. I need something like this: <pre> Header0 | Header123 | Header4 Header0 | Header1 | Header2 | Header3 | Header4 </pre> Is there any way? Thank you in advance
java
swing
jtable
null
null
null
open
Java Swing - Multiple column headers in a JTable? === Is there any way to create multiple column headers in a JTable? I mean, normally there is only one row, but I need two of them with the same format (headerlike), and combine some cells of one of those headers. I need something like this: <pre> Header0 | Header123 | Header4 Header0 | Header1 | Header2 | Header3 | Header4 </pre> Is there any way? Thank you in advance
0
10,546,381
05/11/2012 06:20:41
1,346,217
04/20/2012 09:56:13
0
0
MYsQL Grouping Count Query
Anybody please help me. I have a query that needs to extract data that must show details of a certain model on a process. Here is my query. select x.Sequence as 'Sequence', x.Process as 'Process', x.pdt as 'Production Date', x.mdl as 'Model', count(x.bigbook) as 'Bigbook Count', x.sb as 'Smallbook' from ( select distinct '1' as 'Sequence', 'Cutting' as 'Process', cut_pdt as 'PDT', cut_shf as 'Shift', cut_mdl as 'Mdl', cut_bbn as 'Bigbook', count(cut_sbn) as 'SB' from sum_cut_001 group by cut_bbn) x group by x.mdl That Result that it shows is like this. ---------|---------|-----------------|-------|----------------|------------------| Sequence | Process | Production Date | Model | Big book Count | Small Book Count | ---------|---------|-----------------|-------|----------------|------------------| 1 | Cutting | 2012-01-30 | GSX1 | 3 | 12 | Each Model has 1 Bigbook and each Bigbook has 18 smallbook So if i have 3 bigbooks for model GSX1 the output should be. ---------|---------|-----------------|-------|----------------|------------------| Sequence | Process | Production Date | Model | Big book Count | Small Book Count | ---------|---------|-----------------|-------|----------------|------------------| 1 | Cutting | 2012-01-30 | GSX1 | 3 | 54 | Please Help me on how to query it correctly. Thank in advance.
mysql
null
null
null
null
null
open
MYsQL Grouping Count Query === Anybody please help me. I have a query that needs to extract data that must show details of a certain model on a process. Here is my query. select x.Sequence as 'Sequence', x.Process as 'Process', x.pdt as 'Production Date', x.mdl as 'Model', count(x.bigbook) as 'Bigbook Count', x.sb as 'Smallbook' from ( select distinct '1' as 'Sequence', 'Cutting' as 'Process', cut_pdt as 'PDT', cut_shf as 'Shift', cut_mdl as 'Mdl', cut_bbn as 'Bigbook', count(cut_sbn) as 'SB' from sum_cut_001 group by cut_bbn) x group by x.mdl That Result that it shows is like this. ---------|---------|-----------------|-------|----------------|------------------| Sequence | Process | Production Date | Model | Big book Count | Small Book Count | ---------|---------|-----------------|-------|----------------|------------------| 1 | Cutting | 2012-01-30 | GSX1 | 3 | 12 | Each Model has 1 Bigbook and each Bigbook has 18 smallbook So if i have 3 bigbooks for model GSX1 the output should be. ---------|---------|-----------------|-------|----------------|------------------| Sequence | Process | Production Date | Model | Big book Count | Small Book Count | ---------|---------|-----------------|-------|----------------|------------------| 1 | Cutting | 2012-01-30 | GSX1 | 3 | 54 | Please Help me on how to query it correctly. Thank in advance.
0
10,967,190
06/10/2012 08:06:00
1,419,344
05/26/2012 18:10:49
21
0
richfaces + eclipse ee + tomcat 7
am having a problem configuring tomcat with richfaces. I copied the: richfaces-components-ui-4.2.2.Final.jar richfaces-components-api-4.2.2.Final.jar richfaces-core-api-4.2.2.Final.jar richfaces-core-impl-4.2.2.Final.jar jars into tomcat's \lib and restarted my server. The definition of my xhtml page looks like this: <html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:a4j="http://richfaces.org/a4j" xmlns:rich="http://richfaces.org/rich"> But eclipse generates a warning which says NSL missing: CANNOT_FIND_FACELET_TAGLIB in : org.eclipse.jst.jsf.core.validation.internal.facelet.messages Is there any other thing I need to configure? I skimmed a lot of tutorials but almost all uses JBoss. Is there a way to configure richfaces with my eclipse and tomcat?
jsf
tomcat
configuration
richfaces
null
null
open
richfaces + eclipse ee + tomcat 7 === am having a problem configuring tomcat with richfaces. I copied the: richfaces-components-ui-4.2.2.Final.jar richfaces-components-api-4.2.2.Final.jar richfaces-core-api-4.2.2.Final.jar richfaces-core-impl-4.2.2.Final.jar jars into tomcat's \lib and restarted my server. The definition of my xhtml page looks like this: <html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:a4j="http://richfaces.org/a4j" xmlns:rich="http://richfaces.org/rich"> But eclipse generates a warning which says NSL missing: CANNOT_FIND_FACELET_TAGLIB in : org.eclipse.jst.jsf.core.validation.internal.facelet.messages Is there any other thing I need to configure? I skimmed a lot of tutorials but almost all uses JBoss. Is there a way to configure richfaces with my eclipse and tomcat?
0
8,655,986
12/28/2011 12:35:54
584,448
01/21/2011 12:45:53
205
6
Howto to associate a progressdialog with a service in Android
I have a sync service using AsynTask. Due to its objective (sync), I prefer ton block the user and show him a progressdialog. (And error if exists) Another difficulty is that I have about 8 AsyncTask running simultanious. So I can't to a simple call to the progress dialog page when I begin the work and a close when it's finished. It's more complex. Can someone help me with that task ? Regards
java
android
null
null
null
null
open
Howto to associate a progressdialog with a service in Android === I have a sync service using AsynTask. Due to its objective (sync), I prefer ton block the user and show him a progressdialog. (And error if exists) Another difficulty is that I have about 8 AsyncTask running simultanious. So I can't to a simple call to the progress dialog page when I begin the work and a close when it's finished. It's more complex. Can someone help me with that task ? Regards
0
11,686,836
07/27/2012 11:27:10
897,549
08/16/2011 21:29:41
75
4
Reading Facebook page wall with cron
Im trying to integrate a facebook page wall into my website application. I have no problem with doing so when user is logged in with hes facebook account and is accessing the page wall within my app. What i want to do is to make possible to retrieve those posts with cron job and notify user if new posts are up by mail. When i try to do that i am getting access token error. I have red about offline_access permission but its being deprecated and i couldn't find what the new solution is. Is it possible to do? Thanks in advance.
facebook
facebook-graph-api
null
null
null
null
open
Reading Facebook page wall with cron === Im trying to integrate a facebook page wall into my website application. I have no problem with doing so when user is logged in with hes facebook account and is accessing the page wall within my app. What i want to do is to make possible to retrieve those posts with cron job and notify user if new posts are up by mail. When i try to do that i am getting access token error. I have red about offline_access permission but its being deprecated and i couldn't find what the new solution is. Is it possible to do? Thanks in advance.
0
291,740
11/14/2008 23:12:14
4,834
09/05/2008 20:27:56
380
28
How do I split a huge text file in python
I have a huge text file (~1GB) and sadly the text editor I use won't read such a large file. However, if I can just split it into two or three parts I'll be fine, so, as an exercise I wanted to write a program in python to do it. What I think I want the program to do is to find the size of a file, divide that number into parts, and for each part, read up to that point in chunks, writing to a *filename*.nnn output file, then read up-to the next line-break and write that, then close the output file, etc. Obviously the last output file just copies to the end of the input file. Can you help me with the key filesystem related parts: filesize, reading and writing in chunks and reading to a line-break? I'll be writing this code test-first, so there's no need to give me a complete answer, unless its a one-liner ;-)
python
text-files
null
null
null
null
open
How do I split a huge text file in python === I have a huge text file (~1GB) and sadly the text editor I use won't read such a large file. However, if I can just split it into two or three parts I'll be fine, so, as an exercise I wanted to write a program in python to do it. What I think I want the program to do is to find the size of a file, divide that number into parts, and for each part, read up to that point in chunks, writing to a *filename*.nnn output file, then read up-to the next line-break and write that, then close the output file, etc. Obviously the last output file just copies to the end of the input file. Can you help me with the key filesystem related parts: filesize, reading and writing in chunks and reading to a line-break? I'll be writing this code test-first, so there's no need to give me a complete answer, unless its a one-liner ;-)
0
6,854,156
07/28/2011 04:39:14
863,553
07/26/2011 13:40:34
73
4
More Null Free Shellcode
I am looking to find x86 instructions whose opcodes are NULL free, to replace in a program I wrote. The reason the opcodes need to be NULL free is because I am trying to turn it into null-free shellcode. The first instruction I need to convert to null-free is: mov ebx, str ; the string containing /dev/zero The string str is defined in my .data section. The second is: mov eax,0x5a Thanks!
shell
assembly
null
null
null
null
open
More Null Free Shellcode === I am looking to find x86 instructions whose opcodes are NULL free, to replace in a program I wrote. The reason the opcodes need to be NULL free is because I am trying to turn it into null-free shellcode. The first instruction I need to convert to null-free is: mov ebx, str ; the string containing /dev/zero The string str is defined in my .data section. The second is: mov eax,0x5a Thanks!
0
9,908,871
03/28/2012 13:47:48
1,298,315
03/28/2012 13:38:23
1
0
Iphone query on mapview
I wanted to get Address, city name, state name and zip code when User click on map using latitude and longitude in IOS 5. please help me it's urgent
iphone
null
null
null
null
03/29/2012 18:06:23
not a real question
Iphone query on mapview === I wanted to get Address, city name, state name and zip code when User click on map using latitude and longitude in IOS 5. please help me it's urgent
1
544,430
02/13/2009 01:50:17
43,836
12/05/2008 22:20:51
33
4
How to psyche yourself to just programming the damn thing
I spend far too much time stressing out over the best way to program something instead of just programming the damn thing - a trait I don't think is uncommon among programmers. So, does anyone have techniques for psyching oneself out so I one can relax and let oneself code something which, while not 100% perfect code, is good enough? I know the reasons why (believe me!)... I'd like to know ways of overcoming this mental block.
productivity
null
null
null
null
09/01/2011 03:42:16
not constructive
How to psyche yourself to just programming the damn thing === I spend far too much time stressing out over the best way to program something instead of just programming the damn thing - a trait I don't think is uncommon among programmers. So, does anyone have techniques for psyching oneself out so I one can relax and let oneself code something which, while not 100% perfect code, is good enough? I know the reasons why (believe me!)... I'd like to know ways of overcoming this mental block.
4
11,525,403
07/17/2012 15:03:51
427,769
08/22/2010 17:57:02
806
58
Best practices: Ajax and server side scripting with stored procedures
I need to rebuild an old huge website and probably porting everyting to ASP.NET and jQuery and i would like ask some suggestion and tips. Actually the website use: - Ajax (client site with prototype.js) - ASP (vb script server side) - SQL Server 2005 - IIS 7 as webserver This website use hundred of store procedures and the requests are made by an `ajax call` and **only 1 ASP page** that contain an huge `select case` Shortly an example: JAVASCRIPT + PROTOTYPE var data = { action: 'NEWS', callback: 'doNews', param1: $('text_example').value, ......: ..........}; AjaxGet(data); // perform a call using another function + prototype SERVER SIDE ASP <% ...... select case request("Action") case "NEWS" With cmmDB .ActiveConnection = Conn .CommandText = "sp_NEWS_TO_CALL_for_example" .CommandType = adCmdStoredProc Set par0DB = .CreateParameter("Param1", adVarchar, adParamInput,6) Set par1DB = .CreateParameter(".....", adInteger, adParamInput) ' ........ ' can be more parameters .Parameters.Append par0DB .Parameters.Append par1DB par0DB.Value = request("Param1") par1DB.Value = request(".....") set rs=cmmDB.execute RecodsetToJSON rs, jsa ' create JSON response using a sub End With .... %> So as you can see i have a page ASP that have a **lot of CASE** and this page **answer to all the ajax request** in the site. My question are: 1. Instead to have many CASES is possible to create dynamic vb code that parse the ajax request and create dynamically the call to the desired SP (also implementing the parameters passed by JS)? 2. Or what is the best approach to handle situation like this, by using the advantages of .Net + protoype or jQuery ? 3. How the big sites handle situation like this ? by creating 1 page for request ? Thanks in advance for suggestion, direction and tips
jquery
asp.net
sql-server
asp-classic
prototypejs
07/18/2012 06:41:54
off topic
Best practices: Ajax and server side scripting with stored procedures === I need to rebuild an old huge website and probably porting everyting to ASP.NET and jQuery and i would like ask some suggestion and tips. Actually the website use: - Ajax (client site with prototype.js) - ASP (vb script server side) - SQL Server 2005 - IIS 7 as webserver This website use hundred of store procedures and the requests are made by an `ajax call` and **only 1 ASP page** that contain an huge `select case` Shortly an example: JAVASCRIPT + PROTOTYPE var data = { action: 'NEWS', callback: 'doNews', param1: $('text_example').value, ......: ..........}; AjaxGet(data); // perform a call using another function + prototype SERVER SIDE ASP <% ...... select case request("Action") case "NEWS" With cmmDB .ActiveConnection = Conn .CommandText = "sp_NEWS_TO_CALL_for_example" .CommandType = adCmdStoredProc Set par0DB = .CreateParameter("Param1", adVarchar, adParamInput,6) Set par1DB = .CreateParameter(".....", adInteger, adParamInput) ' ........ ' can be more parameters .Parameters.Append par0DB .Parameters.Append par1DB par0DB.Value = request("Param1") par1DB.Value = request(".....") set rs=cmmDB.execute RecodsetToJSON rs, jsa ' create JSON response using a sub End With .... %> So as you can see i have a page ASP that have a **lot of CASE** and this page **answer to all the ajax request** in the site. My question are: 1. Instead to have many CASES is possible to create dynamic vb code that parse the ajax request and create dynamically the call to the desired SP (also implementing the parameters passed by JS)? 2. Or what is the best approach to handle situation like this, by using the advantages of .Net + protoype or jQuery ? 3. How the big sites handle situation like this ? by creating 1 page for request ? Thanks in advance for suggestion, direction and tips
2
3,439,914
08/09/2010 12:20:41
362,515
06/09/2010 14:07:29
8
1
Dot operator cost c/c++
We all know about -> vs . speed diff to access members in c/c++, but I am hard to find any clues of the actual cost of the simple dot operator. I imagine its something like address-of-struct + offset, also assume the offset being the sum of all sizeof-s of all preceding members. Is this (roughly) correct? Then compared to -> who much faster it is? Twice? (having seen some asm, here on SO, about . access being one instruction, I guess there is some magic about it) Also, how much slower is it, compared to local variable? Thank You
c++
c
dot-operator
null
null
08/09/2010 13:50:50
not a real question
Dot operator cost c/c++ === We all know about -> vs . speed diff to access members in c/c++, but I am hard to find any clues of the actual cost of the simple dot operator. I imagine its something like address-of-struct + offset, also assume the offset being the sum of all sizeof-s of all preceding members. Is this (roughly) correct? Then compared to -> who much faster it is? Twice? (having seen some asm, here on SO, about . access being one instruction, I guess there is some magic about it) Also, how much slower is it, compared to local variable? Thank You
1
9,108,419
02/02/2012 07:12:10
1,163,591
01/22/2012 15:42:23
2
0
php library or project
Write now I am working on web app and we need following functionality for our app(customers) 1. web based permissioning 2. Content(task writing articles) assigning and scheduling 3. moderating (approving/editing/deleting) 4. Can connect to facebook twitter and other social sites for collecting statics for particular article. Please help me
php
null
null
null
null
02/02/2012 09:07:50
not a real question
php library or project === Write now I am working on web app and we need following functionality for our app(customers) 1. web based permissioning 2. Content(task writing articles) assigning and scheduling 3. moderating (approving/editing/deleting) 4. Can connect to facebook twitter and other social sites for collecting statics for particular article. Please help me
1
9,220,933
02/10/2012 00:12:30
931,922
09/07/2011 03:20:00
27
2
Plotting a pie-chart in matplotlib at a specific angle with the fracs on the wedges
I am plotting a piechart with matplotlib using the following code: ax = axes([0.1, 0.1, 0.6, 0.6]) labels = 'Twice Daily', 'Daily', '3-4 times per week', 'Once per week','Occasionally' fracs = [20,50,10,10,10] explode=(0, 0, 0, 0,0.1) patches, texts, autotexts = ax.pie(fracs, labels=labels, explode = explode, autopct='%1.1f%%', shadow =True) proptease = fm.FontProperties() proptease.set_size('xx-small') setp(autotexts, fontproperties=proptease) setp(texts, fontproperties=proptease) rcParams['legend.fontsize'] = 7.0 savefig("pie1") This produces the following piechart. ![PieChart 1][1] However, I want to start the pie-chart with the first wedge on top, the only solution I could find for this was using [this code ][2] However on using this as below, from pylab import * from matplotlib import font_manager as fm from matplotlib.transforms import Affine2D from matplotlib.patches import Circle, Wedge, Polygon import numpy as np fig = plt.figure() ax = fig.add_subplot(111) labels = 'Twice Daily', 'Daily', '3-4 times per week', 'Once per week','Occasionally' fracs = [20,50,10,10,10] wedges, plt_labels = ax.pie(fracs, labels=labels) ax.axis('equal') starting_angle = 90 rotation = Affine2D().rotate(np.radians(starting_angle)) for wedge, label in zip(wedges, plt_labels): label.set_position(rotation.transform(label.get_position())) if label._x > 0: label.set_horizontalalignment('left') else: label.set_horizontalalignment('right') wedge._path = wedge._path.transformed(rotation) plt.savefig("pie2") This produces the following pie chart ![enter image description here][3] However, this does not print the fracs on the wedges as in the earlier pie chart. I have tried a few different things, but I am not able to preserve the fracs. How can I start the first wedge at noon and display the fracs on the wedges as well?? [1]: http://i.stack.imgur.com/kWKOL.png [2]: http://stackoverflow.com/questions/3816809/how-to-plot-a-pie-chart-with-the-first-wedge-on-top-in-python-matplotlib [3]: http://i.stack.imgur.com/RCFwL.png
python
matplotlib
pie-chart
wedge
null
null
open
Plotting a pie-chart in matplotlib at a specific angle with the fracs on the wedges === I am plotting a piechart with matplotlib using the following code: ax = axes([0.1, 0.1, 0.6, 0.6]) labels = 'Twice Daily', 'Daily', '3-4 times per week', 'Once per week','Occasionally' fracs = [20,50,10,10,10] explode=(0, 0, 0, 0,0.1) patches, texts, autotexts = ax.pie(fracs, labels=labels, explode = explode, autopct='%1.1f%%', shadow =True) proptease = fm.FontProperties() proptease.set_size('xx-small') setp(autotexts, fontproperties=proptease) setp(texts, fontproperties=proptease) rcParams['legend.fontsize'] = 7.0 savefig("pie1") This produces the following piechart. ![PieChart 1][1] However, I want to start the pie-chart with the first wedge on top, the only solution I could find for this was using [this code ][2] However on using this as below, from pylab import * from matplotlib import font_manager as fm from matplotlib.transforms import Affine2D from matplotlib.patches import Circle, Wedge, Polygon import numpy as np fig = plt.figure() ax = fig.add_subplot(111) labels = 'Twice Daily', 'Daily', '3-4 times per week', 'Once per week','Occasionally' fracs = [20,50,10,10,10] wedges, plt_labels = ax.pie(fracs, labels=labels) ax.axis('equal') starting_angle = 90 rotation = Affine2D().rotate(np.radians(starting_angle)) for wedge, label in zip(wedges, plt_labels): label.set_position(rotation.transform(label.get_position())) if label._x > 0: label.set_horizontalalignment('left') else: label.set_horizontalalignment('right') wedge._path = wedge._path.transformed(rotation) plt.savefig("pie2") This produces the following pie chart ![enter image description here][3] However, this does not print the fracs on the wedges as in the earlier pie chart. I have tried a few different things, but I am not able to preserve the fracs. How can I start the first wedge at noon and display the fracs on the wedges as well?? [1]: http://i.stack.imgur.com/kWKOL.png [2]: http://stackoverflow.com/questions/3816809/how-to-plot-a-pie-chart-with-the-first-wedge-on-top-in-python-matplotlib [3]: http://i.stack.imgur.com/RCFwL.png
0
1,710,100
11/10/2009 18:22:27
17,312
09/18/2008 06:32:06
4,007
139
Recommendation for a good functional algorithms book
I'm looking for a good algorithms reference for functional programming. I have this book: ![Introduction to Algorithms][1] but all the examples are written in a procedural pseudocode. It's a fantastic book! I also have this one: ![Purely Functional Data Structures][2] Although all the examples are in Standard ML and Haskell, it's not really a complete reference since it doesn't cover some of the "basic" algorithms such as sorting, list operations, permutations, and so forth. Know of any good books? [1]:http://ecx.images-amazon.com/images/I/41hJ7gLDOmL._SL500_AA240_.jpg [2]:http://ecx.images-amazon.com/images/I/410CKVZM2EL._BO2_AA240_SH20_OU01_.jpg
functional-programming
algorithm
books
null
null
09/17/2011 22:43:29
not constructive
Recommendation for a good functional algorithms book === I'm looking for a good algorithms reference for functional programming. I have this book: ![Introduction to Algorithms][1] but all the examples are written in a procedural pseudocode. It's a fantastic book! I also have this one: ![Purely Functional Data Structures][2] Although all the examples are in Standard ML and Haskell, it's not really a complete reference since it doesn't cover some of the "basic" algorithms such as sorting, list operations, permutations, and so forth. Know of any good books? [1]:http://ecx.images-amazon.com/images/I/41hJ7gLDOmL._SL500_AA240_.jpg [2]:http://ecx.images-amazon.com/images/I/410CKVZM2EL._BO2_AA240_SH20_OU01_.jpg
4
2,239,731
02/10/2010 19:32:53
209,878
11/12/2009 19:24:35
310
9
blocking channels vs async message passing
I've noticed two methods to "message passing". One I've seen Erlang use and the other is from Stackless Python. From what I understand here's the difference Erlang Style - Messages are sent and queued into the mailbox of the receiving process. From there they are removed in a FIFO basis. Once the first process sends the message it is free to continue. Python Style - Process a queues up to send to process b. b is currently performing some other action, so a is frozen until b is ready to receive. Once b opens a read channel a sends the data then they both continue Now I see the pros of the Erlang method being that you don't have any blocked processes. If b never is able to receive, a can still continue. However I have noticed in some programs I have written, that it is possible for Erlang message boxes to get full of hundreds (or thousands) of messages since the inflow of messages is greater than the outflow. Now I haven't written a large program in either framework/language so I'm wondering your experiences are with this, and if it's something I should even worry about. Yes, I know this is abstract, but I'm also looking for rather abstract answers.
python
stackless
erlang
actor
null
null
open
blocking channels vs async message passing === I've noticed two methods to "message passing". One I've seen Erlang use and the other is from Stackless Python. From what I understand here's the difference Erlang Style - Messages are sent and queued into the mailbox of the receiving process. From there they are removed in a FIFO basis. Once the first process sends the message it is free to continue. Python Style - Process a queues up to send to process b. b is currently performing some other action, so a is frozen until b is ready to receive. Once b opens a read channel a sends the data then they both continue Now I see the pros of the Erlang method being that you don't have any blocked processes. If b never is able to receive, a can still continue. However I have noticed in some programs I have written, that it is possible for Erlang message boxes to get full of hundreds (or thousands) of messages since the inflow of messages is greater than the outflow. Now I haven't written a large program in either framework/language so I'm wondering your experiences are with this, and if it's something I should even worry about. Yes, I know this is abstract, but I'm also looking for rather abstract answers.
0
5,676,682
04/15/2011 12:25:14
84,336
03/29/2009 19:17:00
585
15
Java + Web interface
I'm writing a small application and I want to visualize results so I can see them in a web browser. For example, I want to display a plot of my data points. Sure, I can write a http listener, that will serve an programatically built html. Or I can use java web application stack, but this seems a bit heavy weight for this simple task. What do you recommend to do?
java
null
null
null
null
04/16/2011 22:25:55
not a real question
Java + Web interface === I'm writing a small application and I want to visualize results so I can see them in a web browser. For example, I want to display a plot of my data points. Sure, I can write a http listener, that will serve an programatically built html. Or I can use java web application stack, but this seems a bit heavy weight for this simple task. What do you recommend to do?
1
7,347,929
09/08/2011 12:21:38
882,956
08/07/2011 17:09:09
1
0
Annoying tick with speex
I am making an applicatoin in which i use Speex, OpenAL and linsndfile. The problem is taht when i write a sample buffer in the file (raw pcm unsigned 16) using libsndfile everything is right.But if i encode them, then decode them using Spexx, i get like a 'tick' between each sample. I first though about a sample loss or some buffer being too big. But i did'nt find anything. At first the code was in an architecture with boost threads and was splitted in multiple classes. Even which this minimal code, my problem is still. Here is the full minimal code which produce the problem. Thanks for you help. <pre> #include <iostream> #include <stdexcept> #include <vector> #include <cstring> #include <algorithm> #include <sndfile.h> #include <AL/al.h> #include <AL/alc.h> #include <speex/speex.h> typedef std::vector<ALshort> Samples; std::string chooseDevice() { std::vector<std::string> ret; const ALCchar* DeviceList = alcGetString(NULL, ALC_CAPTURE_DEVICE_SPECIFIER); int i = 0; if (DeviceList) while (strlen(DeviceList) > 0) { std::string tmp = DeviceList; ret.push_back(tmp); DeviceList += strlen(DeviceList) + 1; std::cout << i++ << ": " << tmp << std::endl; } std::cout << "Choose a device : " << std::flush; if (!(std::cin >> i)) throw std::runtime_error("NaN"); return ret[i]; } SNDFILE* openFile() { SNDFILE* file; SF_INFO fileInfo; fileInfo.channels = 1; fileInfo.samplerate = 8000; fileInfo.format = SF_FORMAT_PCM_16 | SF_FORMAT_WAV; file = sf_open("capture.wav", SFM_WRITE, &fileInfo); if (!file) throw std::runtime_error("SNDFILE error"); return file; } enum Mode {DIRECT = 1, ENCODE_AND_DECODE}; void writeToFile(SNDFILE* file, const Samples& samples, const Mode mode) { static std::vector<ALshort> buffer; switch (mode) { case DIRECT: sf_write_short(file, &samples[0], samples.size()); break; // Ecriture ici case ENCODE_AND_DECODE: { std::copy(samples.begin(), samples.end(), std::back_inserter(buffer)); int frameSize; void* encoderState = speex_encoder_init(&speex_wb_mode); speex_encoder_ctl(encoderState, SPEEX_GET_FRAME_SIZE, &frameSize); // AL pourrait donner trop ou pas assez d'échantillons while (buffer.size() >= frameSize) { // encodage void* encoderState = speex_encoder_init(&speex_wb_mode); SpeexBits bits; speex_encoder_ctl(encoderState, SPEEX_GET_FRAME_SIZE, &frameSize); buffer.reserve(2*frameSize); std::vector<char> output; output.resize(2*frameSize); speex_bits_init(&bits); speex_encode_int(encoderState, &buffer[0], &bits); int bytes = speex_bits_write(&bits, &output[0], output.size()); speex_bits_destroy(&bits); speex_encoder_destroy(encoderState); // décodage speex_bits_init(&bits); encoderState = speex_decoder_init(&speex_wb_mode); speex_encoder_ctl(encoderState, SPEEX_GET_FRAME_SIZE, &frameSize); speex_bits_read_from(&bits, &output[0], bytes); std::vector<short> samples(frameSize); speex_decode_int(encoderState, &bits, &samples[0]); sf_write_short(file, &samples[0], frameSize); // Ecriture ici speex_decoder_destroy(encoderState); speex_bits_destroy(&bits); buffer.erase(buffer.begin(), buffer.begin()+frameSize); std::cout << "." << std::flush; } } break; } } void closeFile(SNDFILE* file) { sf_close(file); std::cout << "enregistré dans capture.wav" << std::endl; } int main() { ALCdevice* device; ALCdevice* captureDevice; ALCcontext* context; device = alcOpenDevice(0); if (!device) throw std::runtime_error("Unable to open the AL device"); context = alcCreateContext(device, 0); if (!context) throw std::runtime_error("Unable to create AL context"); if (!alcMakeContextCurrent(context)) throw std::runtime_error("Unable to set the context"); if (alcIsExtensionPresent(device, "ALC_EXT_CAPTURE") == AL_FALSE) throw std::runtime_error("AL Capture extension not available"); captureDevice = alcCaptureOpenDevice(chooseDevice().c_str(), 8000, AL_FORMAT_MONO16, 8000); if (!captureDevice) throw std::runtime_error("Unable to open the capture device"); Samples samples; SNDFILE* file = openFile(); std::cout << "Mode direct (1) ou encodage et décodage ? (2) : " << std::endl; int i; std::cin >> i; Mode mode = Mode(i); time_t start = time(0); alcCaptureStart(captureDevice); while (time(0) - start < 5) { ALCint availableSamples; alcGetIntegerv(captureDevice, ALC_CAPTURE_SAMPLES, 1, &availableSamples); if (availableSamples > 0) { samples.resize(availableSamples); alcCaptureSamples(captureDevice, &samples[0], availableSamples); writeToFile(file, samples, mode); } } alcCaptureStop(captureDevice); closeFile(file); alcCaptureCloseDevice(captureDevice); alcMakeContextCurrent(0); alcDestroyContext(context); alcCloseDevice(device); } </pre> ( -lspeex -lsndfile -lopenal)
c++
speex
null
null
null
09/18/2011 20:30:35
too localized
Annoying tick with speex === I am making an applicatoin in which i use Speex, OpenAL and linsndfile. The problem is taht when i write a sample buffer in the file (raw pcm unsigned 16) using libsndfile everything is right.But if i encode them, then decode them using Spexx, i get like a 'tick' between each sample. I first though about a sample loss or some buffer being too big. But i did'nt find anything. At first the code was in an architecture with boost threads and was splitted in multiple classes. Even which this minimal code, my problem is still. Here is the full minimal code which produce the problem. Thanks for you help. <pre> #include <iostream> #include <stdexcept> #include <vector> #include <cstring> #include <algorithm> #include <sndfile.h> #include <AL/al.h> #include <AL/alc.h> #include <speex/speex.h> typedef std::vector<ALshort> Samples; std::string chooseDevice() { std::vector<std::string> ret; const ALCchar* DeviceList = alcGetString(NULL, ALC_CAPTURE_DEVICE_SPECIFIER); int i = 0; if (DeviceList) while (strlen(DeviceList) > 0) { std::string tmp = DeviceList; ret.push_back(tmp); DeviceList += strlen(DeviceList) + 1; std::cout << i++ << ": " << tmp << std::endl; } std::cout << "Choose a device : " << std::flush; if (!(std::cin >> i)) throw std::runtime_error("NaN"); return ret[i]; } SNDFILE* openFile() { SNDFILE* file; SF_INFO fileInfo; fileInfo.channels = 1; fileInfo.samplerate = 8000; fileInfo.format = SF_FORMAT_PCM_16 | SF_FORMAT_WAV; file = sf_open("capture.wav", SFM_WRITE, &fileInfo); if (!file) throw std::runtime_error("SNDFILE error"); return file; } enum Mode {DIRECT = 1, ENCODE_AND_DECODE}; void writeToFile(SNDFILE* file, const Samples& samples, const Mode mode) { static std::vector<ALshort> buffer; switch (mode) { case DIRECT: sf_write_short(file, &samples[0], samples.size()); break; // Ecriture ici case ENCODE_AND_DECODE: { std::copy(samples.begin(), samples.end(), std::back_inserter(buffer)); int frameSize; void* encoderState = speex_encoder_init(&speex_wb_mode); speex_encoder_ctl(encoderState, SPEEX_GET_FRAME_SIZE, &frameSize); // AL pourrait donner trop ou pas assez d'échantillons while (buffer.size() >= frameSize) { // encodage void* encoderState = speex_encoder_init(&speex_wb_mode); SpeexBits bits; speex_encoder_ctl(encoderState, SPEEX_GET_FRAME_SIZE, &frameSize); buffer.reserve(2*frameSize); std::vector<char> output; output.resize(2*frameSize); speex_bits_init(&bits); speex_encode_int(encoderState, &buffer[0], &bits); int bytes = speex_bits_write(&bits, &output[0], output.size()); speex_bits_destroy(&bits); speex_encoder_destroy(encoderState); // décodage speex_bits_init(&bits); encoderState = speex_decoder_init(&speex_wb_mode); speex_encoder_ctl(encoderState, SPEEX_GET_FRAME_SIZE, &frameSize); speex_bits_read_from(&bits, &output[0], bytes); std::vector<short> samples(frameSize); speex_decode_int(encoderState, &bits, &samples[0]); sf_write_short(file, &samples[0], frameSize); // Ecriture ici speex_decoder_destroy(encoderState); speex_bits_destroy(&bits); buffer.erase(buffer.begin(), buffer.begin()+frameSize); std::cout << "." << std::flush; } } break; } } void closeFile(SNDFILE* file) { sf_close(file); std::cout << "enregistré dans capture.wav" << std::endl; } int main() { ALCdevice* device; ALCdevice* captureDevice; ALCcontext* context; device = alcOpenDevice(0); if (!device) throw std::runtime_error("Unable to open the AL device"); context = alcCreateContext(device, 0); if (!context) throw std::runtime_error("Unable to create AL context"); if (!alcMakeContextCurrent(context)) throw std::runtime_error("Unable to set the context"); if (alcIsExtensionPresent(device, "ALC_EXT_CAPTURE") == AL_FALSE) throw std::runtime_error("AL Capture extension not available"); captureDevice = alcCaptureOpenDevice(chooseDevice().c_str(), 8000, AL_FORMAT_MONO16, 8000); if (!captureDevice) throw std::runtime_error("Unable to open the capture device"); Samples samples; SNDFILE* file = openFile(); std::cout << "Mode direct (1) ou encodage et décodage ? (2) : " << std::endl; int i; std::cin >> i; Mode mode = Mode(i); time_t start = time(0); alcCaptureStart(captureDevice); while (time(0) - start < 5) { ALCint availableSamples; alcGetIntegerv(captureDevice, ALC_CAPTURE_SAMPLES, 1, &availableSamples); if (availableSamples > 0) { samples.resize(availableSamples); alcCaptureSamples(captureDevice, &samples[0], availableSamples); writeToFile(file, samples, mode); } } alcCaptureStop(captureDevice); closeFile(file); alcCaptureCloseDevice(captureDevice); alcMakeContextCurrent(0); alcDestroyContext(context); alcCloseDevice(device); } </pre> ( -lspeex -lsndfile -lopenal)
3
5,260,874
03/10/2011 14:16:13
653,695
03/10/2011 14:16:13
1
0
event handling in objective c
i try to inspect the low-level of the uiresponder,Because i try to get to the bottom of what happen when i press a button(uibutton), if there is any other methods that called when a button is clicked or only the IBaction that i had defined.
iphone
objective-c
null
null
null
null
open
event handling in objective c === i try to inspect the low-level of the uiresponder,Because i try to get to the bottom of what happen when i press a button(uibutton), if there is any other methods that called when a button is clicked or only the IBaction that i had defined.
0
3,958,425
10/18/2010 10:56:02
475,349
09/08/2010 13:04:04
1
0
regarding intents
i am new to android. i want sample program how to use intent
android
null
null
null
null
10/18/2010 12:30:25
not a real question
regarding intents === i am new to android. i want sample program how to use intent
1
6,989,217
08/08/2011 22:10:26
657,676
03/13/2011 16:41:32
55
0
Fancybox and Quicksand - Bit of a headache
I've been trying to get Fancybox and Quicksand to work together. I've got them both working, on the same page, just not "together". Here's some pieces of code: <head> <script type="text/javascript"> $(document).ready(function() { $("a:visible").fancybox({ 'type' : 'image', 'titlePosition' : 'outside', 'overlayColor' : '#000', 'overlayOpacity' : 0.7 }); }); </script> </head> And Then: <a href="./gallery/img/shots/3.jpg" ><img src="./gallery/img/shots/3.jpg" /></a> Together, these work. However, is doesn't work (Just opens image in new tab) on anything in the Quicksand "area", such as: <section id="container"> <ul id="stage"> <li data-tags="Urban"><a href="./gallery/img/shots/1.jpg"><img src="./gallery/img/shots/1.jpg" alt="Illustration" /></li></a> </ul> </section> I've looked around, and found that I might have to change the following code from the tutorial: $('#stage').quicksand(link.data('list').find('li')); to $('#stage').quicksand(link.data('list').find('li'),function(){ // FancyBox initialization code. }); I've also looked around for this "initialization code", and all I;ve found is `fancybox_init();`. This doesn't seem to do anything? :S I've also tried changing it to the `$('a:visible').fancybox({...});`, but this doesn't work either. I know it's something small/silly, I just can't see it. I know this works on any link on the page, but that's something to fix later, I don;t think it's the issue? Thanks for any help, Joseph Duffy
jquery
jquery-plugins
fancybox
quicksand
null
null
open
Fancybox and Quicksand - Bit of a headache === I've been trying to get Fancybox and Quicksand to work together. I've got them both working, on the same page, just not "together". Here's some pieces of code: <head> <script type="text/javascript"> $(document).ready(function() { $("a:visible").fancybox({ 'type' : 'image', 'titlePosition' : 'outside', 'overlayColor' : '#000', 'overlayOpacity' : 0.7 }); }); </script> </head> And Then: <a href="./gallery/img/shots/3.jpg" ><img src="./gallery/img/shots/3.jpg" /></a> Together, these work. However, is doesn't work (Just opens image in new tab) on anything in the Quicksand "area", such as: <section id="container"> <ul id="stage"> <li data-tags="Urban"><a href="./gallery/img/shots/1.jpg"><img src="./gallery/img/shots/1.jpg" alt="Illustration" /></li></a> </ul> </section> I've looked around, and found that I might have to change the following code from the tutorial: $('#stage').quicksand(link.data('list').find('li')); to $('#stage').quicksand(link.data('list').find('li'),function(){ // FancyBox initialization code. }); I've also looked around for this "initialization code", and all I;ve found is `fancybox_init();`. This doesn't seem to do anything? :S I've also tried changing it to the `$('a:visible').fancybox({...});`, but this doesn't work either. I know it's something small/silly, I just can't see it. I know this works on any link on the page, but that's something to fix later, I don;t think it's the issue? Thanks for any help, Joseph Duffy
0
11,549,899
07/18/2012 20:36:14
1,536,041
07/18/2012 20:22:29
1
0
Write a TCP Echo Program?
I am trying to write a TCP Echo program that should open a TCP server socket, accept at least 1 connection, and echo back any data received. At minimum, this program should launch and run on a specified port (exe: port 4444". Ideally, it would ask for a port number (from command line, command line parameter, or config file), attempt to open on that port, and report if errors occurred. The program is supposed to be tested using the telnet command from windows or Linux, or any terminal emulator in any OS. The use connects to the running program using Telnet or Hyperterminal. Anything that gets typed in should echo back immediately. So far I have the following: #include <stdio.h> #include <sys/socket.h> #include <arpa/inet.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <netinet/in.h> #include <errno.h> #define MAXCONNECTING 1000 //Max connection requests #define BUFFERSIZE 128 //limits data sent per loop #define ECHOPORT 4444 //Error checking function //Will be called multiple times to check for errors throughout the code void ERR(char *ERROR) { perror(ERROR); exit(1); } /**************************************************************************** * Handles the connection. Receive/Send data from/to client ****************************************************************************/ void ClientHandle(int sock) { char buffer[BUFFERSIZE]; int received = -1; //receive the data if ((received = recv(sock, buffer, BUFFERSIZE, 0)) < 0) { ERR("Failed to receive message from client"); } //send data and check for more incoming data while (received > 0) { if (send(sock, buffer, received, 0) != received) { ERR("Failed to send data to client"); } if ((received = recv(sock, buffer, BUFFERSIZE, 0)) < 0) { ERR("Failed to receive additional data from client"); } } close(sock); } int main(int argc, char *argv[]) { /**************************************************************************** * Get port number from command line and set to default port ****************************************************************************/ char *endptr; short int port; if (argc == 2) { port = strtol(argv[1], &endptr, 0); if (*endptr) { fprintf(stderr, "EchoServer: Invalid Port Number.\n"); exit(EXIT_FAILURE); } } else if (argc < 2) { port = ECHOPORT; //port 4444 } else { fprintf(stderr, "EchoServer: Invalid arguments.\n"); exit(EXIT_FAILURE); } /**************************************************************************** * Server Configuration. Creating the socket ****************************************************************************/ int serversock, clientsock; struct sockaddr_in echoserver, echoclient; if (argc != 2) { fprintf(stderr, "USING: echoserver Port: 4444\n"); exit(1); } //Creating the TCP socket if ((serversock = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0) { ERR("Failed to create socket"); } //Constructing the server sockaddr_in structure memset(&echoserver, 0, sizeof(echoserver)); //clear struct echoserver.sin_family = AF_INET; //internet ip echoserver.sin_addr.s_addr = htonl(INADDR_ANY); //listen to any ip address echoserver.sin_port = htons(atoi(argv[1])); //server port /***************************************************************************** * Bind and Listen *****************************************************************************/ if (bind(serversock, (struct sockaddr *) &echoserver, sizeof (echoserver)) < 0) { ERR("Failed to bind the server socket"); } if (listen(serversock, MAXCONNECTING) < 0) { ERR("Failed to listen on server socket"); } /***************************************************************************** * Accepting the transmission *****************************************************************************/ while (1) { unsigned int clientleng = sizeof (echoclient); if ((clientsock = accept(serversock, (struct sockaddr *) &echoclient, &clientleng)) < 0) { ERR("Failed to accept connection from client"); } fprintf(stdout, "Client connected: %s\n", inet_ntoa(echoclient.sin_addr)); ClientHandle(clientsock); } return (0); } /*****************************************************************************************/ Can anyone see where I have went wrong? I can find the program in terminal using the command: g++ EchoServer.cpp -0 EchoServer and then followed by: ./EchoServer The ouput only gives me: USING: echoserver Port: 4444 I am trying to telnet to it, but I am very new at this stuff. Please help!!
socketserver
tcpsocket
null
null
null
null
open
Write a TCP Echo Program? === I am trying to write a TCP Echo program that should open a TCP server socket, accept at least 1 connection, and echo back any data received. At minimum, this program should launch and run on a specified port (exe: port 4444". Ideally, it would ask for a port number (from command line, command line parameter, or config file), attempt to open on that port, and report if errors occurred. The program is supposed to be tested using the telnet command from windows or Linux, or any terminal emulator in any OS. The use connects to the running program using Telnet or Hyperterminal. Anything that gets typed in should echo back immediately. So far I have the following: #include <stdio.h> #include <sys/socket.h> #include <arpa/inet.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <netinet/in.h> #include <errno.h> #define MAXCONNECTING 1000 //Max connection requests #define BUFFERSIZE 128 //limits data sent per loop #define ECHOPORT 4444 //Error checking function //Will be called multiple times to check for errors throughout the code void ERR(char *ERROR) { perror(ERROR); exit(1); } /**************************************************************************** * Handles the connection. Receive/Send data from/to client ****************************************************************************/ void ClientHandle(int sock) { char buffer[BUFFERSIZE]; int received = -1; //receive the data if ((received = recv(sock, buffer, BUFFERSIZE, 0)) < 0) { ERR("Failed to receive message from client"); } //send data and check for more incoming data while (received > 0) { if (send(sock, buffer, received, 0) != received) { ERR("Failed to send data to client"); } if ((received = recv(sock, buffer, BUFFERSIZE, 0)) < 0) { ERR("Failed to receive additional data from client"); } } close(sock); } int main(int argc, char *argv[]) { /**************************************************************************** * Get port number from command line and set to default port ****************************************************************************/ char *endptr; short int port; if (argc == 2) { port = strtol(argv[1], &endptr, 0); if (*endptr) { fprintf(stderr, "EchoServer: Invalid Port Number.\n"); exit(EXIT_FAILURE); } } else if (argc < 2) { port = ECHOPORT; //port 4444 } else { fprintf(stderr, "EchoServer: Invalid arguments.\n"); exit(EXIT_FAILURE); } /**************************************************************************** * Server Configuration. Creating the socket ****************************************************************************/ int serversock, clientsock; struct sockaddr_in echoserver, echoclient; if (argc != 2) { fprintf(stderr, "USING: echoserver Port: 4444\n"); exit(1); } //Creating the TCP socket if ((serversock = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0) { ERR("Failed to create socket"); } //Constructing the server sockaddr_in structure memset(&echoserver, 0, sizeof(echoserver)); //clear struct echoserver.sin_family = AF_INET; //internet ip echoserver.sin_addr.s_addr = htonl(INADDR_ANY); //listen to any ip address echoserver.sin_port = htons(atoi(argv[1])); //server port /***************************************************************************** * Bind and Listen *****************************************************************************/ if (bind(serversock, (struct sockaddr *) &echoserver, sizeof (echoserver)) < 0) { ERR("Failed to bind the server socket"); } if (listen(serversock, MAXCONNECTING) < 0) { ERR("Failed to listen on server socket"); } /***************************************************************************** * Accepting the transmission *****************************************************************************/ while (1) { unsigned int clientleng = sizeof (echoclient); if ((clientsock = accept(serversock, (struct sockaddr *) &echoclient, &clientleng)) < 0) { ERR("Failed to accept connection from client"); } fprintf(stdout, "Client connected: %s\n", inet_ntoa(echoclient.sin_addr)); ClientHandle(clientsock); } return (0); } /*****************************************************************************************/ Can anyone see where I have went wrong? I can find the program in terminal using the command: g++ EchoServer.cpp -0 EchoServer and then followed by: ./EchoServer The ouput only gives me: USING: echoserver Port: 4444 I am trying to telnet to it, but I am very new at this stuff. Please help!!
0