15,748,249 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View Javascript questions
View C++ questions
View Python questions
View Java questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by leon de boer (Top 62 by date)
leon de boer
3-Mar-17 12:24pm
View
If he isn't doing in place he needs to change his interface so he doesn't commit a C crime against humanity.
int afunction(char *s1, char *s2, char* outbuf)
OR
int afunction(char *s1, char *s2, char* outs1, char* outs2)
Then he still doesn't need the number of pointers he has because the interface defines 4 and he still needs just 1 inside the function to move around as his temporary (I would accept two for a beginner). That is the whole point of the local interface it forces him to set the pointers or it won't compile and he wouldn't be here :-)
That is why this is pretty black and white, once students start playing around with local functions they need to know why that local interface exists. It's not there for good looks, it's there to protect you from doing dangerous things.
leon de boer
3-Mar-17 1:06am
View
It basically has to be in place because he hasn't got access to anything else unless you allow pure stupidity and are going to set the pointer to a global. One would hope they still teach setting a char* pointer to a global is beyond dangerous it is actually stupid and reckless. You would be fired for doing that in my company as it's basic pointer safety 101, because putting an extra pointer on the interface for output is ever so hard.
So I guess if we follow your lead he is doing it all wrong he should have s1 and s2 as globals, heck who needs a local interface its just a waste of time and we end up writing something that looks like GW Basic :-)
leon de boer
28-Jun-16 23:25pm
View
Same thing the errors are syntax from something earlier ... the keyword "unsigned" is known to every C compiler so the compiler parser has essentially crashed. The first error is at line 67, so the problem is in those first 67 lines. Are there any warnings in the earlier lines???
Don't ignore warnings when you have this sort of error you need to deal with the problems in line order. So our question is what is going wrong in the first 66 lines of USART.H that is causing the problem in line 67. Look at any warnings in those early lines and failing all else post me the first 67 lines of USART.H
leon de boer
5-Jun-16 11:29am
View
Look at the function strchr and use it find a whitespace character. When you have them all write the string back out starting from last one first.
leon de boer
5-Jun-16 10:28am
View
I put the solution at the end since you got stuck and are losing heart :-)
There are various ways to do the loops but that is basics and it is important you understand the comments, so you get what you should have done.
leon de boer
1-Jun-16 8:17am
View
I fixed the format for him he just had not put it in code blocks.
leon de boer
30-May-16 3:49am
View
There is nothing to discuss he/she needs to meet C99 standard to get past the C99 checker the uni submission program is running, he/she has no choice. Memory leaks will likely be done by the uni marker manually and his/her mark will probably reflect that, they did in my day.
What you and I think of the university standard or each other matters little, that is the problem they are having which has been identified. They need to program to C99 or not pass it's a simple choice because the automated submission program isn't going to suddenly stop enforcing C99 and allow the submission of that code.
You are free to say it's wrong but really the OP has no option but to change it .... computer says NO :-)
leon de boer
30-May-16 2:28am
View
The fact is he can't submit his work and pass his programming coarse until he does what is required and what you believe in your little free country doesn't come into it. He is required to program to the standard to pass his coarse and he was asking why it wouldn't accept it, well because it doesn't meet the standard the Uni coarse demands.
For the record I often set that as a problem when hiring programmers to sort out the good ones.
I am aware Visual Studio since VS2013 allows character subtraction basically because too many idiots couldn't deal with warning it threw. They do at least acknowledge it isn't to C99 standard. The official MS line is Visual C++ partly supports some C99 language features under a slightly different syntax and possibly with slightly different semantics. The new standard C11 which very few compilers meet that code will still create a warning.
leon de boer
29-May-16 22:07pm
View
The rules of C are EXPLICIT and not up for you to debate, they are covered by specifications C90, C99 etc.
If you want to claim that your character is signed then you needed to define it so there is a type "signed char" for that exact reason, the code as stands uses "char" which is unsigned. Bottom line if you want negatives in your char type you need to tell the compiler thats what you are doing. Any compiler will produce a warning on that line of code and the uni are obviously testing with there warnings turned up to full and it rightfully rejects the code. They are trying to teach him to be a programmer, not someone punching out hack error prone code that you see of the internet.
So looking at your claim, yes if you had defined c as signed char the compiler would have no problem and so you just created a 3rd correct way to fix it. So this would be the fix using your suggestion and that would be valid and lift no compiler warning.
signed char c;
int sor = c - (signed char)'0';
The code as written is definitely wrong, period and you can't argue it and why the uni submission program rejects it. I agree you will see the code as written all over the internet but that doesn't make it right and there is a lesson about types in it for him :-)
leon de boer
12-May-16 12:52pm
View
To keep Windows CE small, Microsoft decided not to support ANSI Windows functions at all. So if you are developing for Windows CE, you must understand and use Unicode throughout your application.
That is why you had to use TCHAR.H to compile and you need to specifically set the language to unicode for it to work on CE. It will appear to make no difference to you on the desktop computer because it understands both but CE does not. That is why I wanted you compiling unicode mode.
You also need to check the default console font on the PDA has the characters you want, not all characters are defined by default to save memory space. You may need to load languages via control panel to get fonts with specific characters. They simply do not have the drive space you do on a PC to just randomly install everything.
leon de boer
12-May-16 9:49am
View
Okay you will have to ask the manufacturer for the programming and command set datasheets for the RFID module.
leon de boer
11-May-16 14:38pm
View
The manual says that is set via the settings menu on the device. There is probably a way to do it via a program but there is no program developer support documentation on it up on there website. I notice they do have support documentation for the barcode reader up there which is similar to what you need.
The device has 4 standards it uses on the RFID UHF: 840Mhz, 960Mhz OR Low Freq: 125Khz, 134.2Khz. Which does it default to at the moment?
So its really a question of getting a copy of the support documentation for the iRDA OR a copy of there CE driver code both which require you to talk to the supplier because they have nothing available on the website. It will be pretty basic but there really isn't anything to go on without more detail.
Now being an embedded programmer by trade I am going to let you in on a little secret which might work. Get a terminal program (like hyperterminal) and open com4 using it with 9600,n,8,1. Now type ?? and then the enter key. Most of us embedded programmers use this ?? to spew the commands for modules connected via a com port out to you. If someone like me has made the module it will give you the command to change the frequency via a command on the com port right onto your screen, as well as all the other commands to change things on the RFID.
I guess you have the port open in your code above so you could just write "??\r\n" to the port. Then go read the data from the port but be prepared if the ?? works the amount of data could be massive like several screens full or something like a thousand characters.
leon de boer
11-May-16 5:04am
View
You are using the include file TCHAR.H which simply allows compiling in multiple language setting modes. It's changed in the General tab -> character set in the project properties you have 3 options, "Not set" (ascii mode), "use unicode character set" (unicode mode) or "Use Multibyte character set" (MBCS mode) which changes what a "character" is and means. It basically allows you to have more than 256 characters which you may need for languages other than English. Anyhow you can change the settings and all will be fine, without TCHAR.H you would be forced to select one of the settings and write to that specification.
When you say modulation is the port connected to a modem?? Or do you mean how do you change the port settings such as it's baud rate, stop and start bits etc??
Anyhow I will assume you mean BAUD rate etc which you can do once you have your comm handle
DCB PortDCB;
// Initialize the DCBlength member.
PortDCB.DCBlength = sizeof (DCB);
// Get the port setting information from your handle you got from open
GetCommState (m_hUsbCom, &PortDCB);
// You can change settings in the return DCB structure to what you want
// I will do 9600,n,8,1
PortDCB.BaudRate = 9600;
PortDCB.ByteSize = 8;
PortDCB.Parity = NOPARITY;
PortDCB.StopBits = ONESTOPBIT;
// Then write it back
if (!SetCommState (m_hUsbCom, &PortDCB)){
// Some error occured if in here
}
FINALLY DON'T FORGET TO CLOSE HANDLE WHEN FINISHED OR EXITING
// Close the comm handle
CloseHandle(m_hUsbCom);
leon de boer
25-Apr-16 22:47pm
View
That won't work its old using the old GUID import and is specific to Excel 2007 on VS2010
leon de boer
20-Apr-16 12:26pm
View
ClientSocket.Connect("59.92.111.69", 8080); That line there connects to a HTTP server at IP 59.92.111.69 on port 8080. So if that isn't a server then you are wasting your time. So do you know if that is actually a server or not? Where did you get this IP and port from?
So lets assume you misunderstood when you said I don't have a server, and there is a server you are connecting to at that address and you do that via your two lines of code. Now if that isn't a server try ClientSocket.Connect("www.microsoft.com", 80); that will definitely be online we hope :-)
ClientSocket.Connect("59.92.111.69", 8080);
NetworkStream serverStream = clientSocket.GetStream();
Great so now you connected to the HTTP server, so now you need to tell it you want data you do so by writing a command to it and that is the connect string I gave you
if (serverStream.CanWrite){
byte[] myWriteBuffer = Encoding.ASCII.GetBytes("GET / HTTP/1.0/r/nConnection: keep-alive/r/n/r/n");
serverStream.Write(myWriteBuffer, 0, myWriteBuffer.Length);
} else{
Console.WriteLine("Sorry. fix serverStream and make it writable.");
}
Now it will respond back to you. so feel free to run your receive code and you should get a response of "HTTP/1.0 200 OK"
Do you get it you have to write a command, then read its response that it will send you in response for what you asked for.
You can't just listen and try to receive data like you did above you will get nothing. You have to send it a command.
Think like a DOS command line. You type in a command and the OS responds putting stuff to the screen. That is how a HTTP server works you send a command it responds.
leon de boer
20-Apr-16 11:38am
View
Its just a container class so the client and service are paired. Imagine you had multiple clients and multiple services ... well actually try it :-)
Now go to PasswordServiceTest.java which is actually the injection test, and you will see the significance of AppConfig.java
leon de boer
20-Apr-16 9:35am
View
There you go I put a splitter control down the middle and moved it so right side smaller than left
http://i65.tinypic.com/xd7dhd.jpg
Its all just an illussion its actually two windows that totally occupy the client area of the parent window with there borders turned off.
I pulled all the MDI code out, code for just a straight splitter window now ... http://s000.tinyupload.com/?file_id=08701924383590736839
Load left or right window off menu or drag and drop a file on the window side you want.
leon de boer
20-Apr-16 8:50am
View
I am sort of stunned you are asking me that as that is nothing to do with OpenGL. Slide two windows inside the parent window just like normal in an MFC application, the parent doesn't draw. Have you done splitter planes before?.
In my MDI example put two windows up and tile them. If I turned the border style off you have exactly what you are asking for. You can actually do it if you want just turn the WS_OVERLAPPEDWINDOW style off the MDI child and you have two black screens butted hard against each other inside the parent. hmmm let me put a small frame so you see them and I will put splitter on frame.
Update: LOL took me two seconds to do it is this what you mean ... http://tinypic.com/view.php?pic=lh7k7&s=9
Thats two MDIchildren side by side with frames turned off ... looks like one screen to you doesn't it. With a control in on the parent you could even slide the views.
leon de boer
19-Apr-16 20:48pm
View
I will tell the department of scientific visualization in most universities that there is nothing scientific about one of their subsections. There is nothing specific about the terms Quantum Mechanics or Newtonian Physics either should we remove them as scientific terms as well?
Perhaps the alternative is you know nothing of the subject area and so it is meaningless to you. I accept you don't like the term but I am not sure that matters as enhzflep said its used so widely in the science community its a section.
I just ran a search on the term "volume rendering" (together as one term) in the physics.org and I get over 1000+ articles and asked to refine my search. It includes everything from reconstructing the anatomy of dinosaurs and ancient man, works on the expansion of space, research and visualization of the expansion and collapse of the death of a star to become a Nova or super Nova, the 3D occupancy of electron clouds around an atom and in solids, Superconductivity research and then normal medical and x-ray techniques. That is just the first couple of pages.
For comparison I used the term "CAPTCHA" which lists in the top 20 computer terms apparently (http://www.dailywritingtips.com/20-computer-terms-you-should-know/) and I get 28 entries most of them around google buying companies and a couple of hacker reports and one about Standford University have robot code that can defeat it.
For the record "Quantum Mechanics" only reports 894 results but the singular word Quantum returns 1000+ as well.
"Newtonian Mechanics" has zero entries which surprised me, I changed it to "Classical mechanics" which returned 8 and then "classical physics" which returned 9. Looks like classical physics as a science term goes ... hated that at high school so good riddance :-)
I think that is a reasonable comparison to show how wide the term is used in science research.
For my part it is a hell of lot more descriptive than most of the letter jargons (CAPTCHA a prime example) that gets use in computer programming, its is after all a render surface put around a volume of space ... so volume rendering is a good name.
leon de boer
19-Apr-16 15:15pm
View
Sorry that it not the codes fault it is yours .. YOU ARE SENDING AN INVALID REQUEST.
The reason it is invalid I can guess at, because you are talking to port 443 and this site "https://mapi.alipay.com", so I am pretty sure it is a HTTPS server not a HTTP server.
To connect to a HTTPS server you must create a public key certificate from a certificate provider and that certificate must trusted by both server and client. If it is a HTTPS server it's never going to accept a single command without the security connection. So no your code from HttpBin will not work until you fix the security connection up.
So I suspect the problem is nothing to do with low level code but more your lack of understanding.
Your next step is to probably talk to alipay.com and find out what certificates they will accept.
leon de boer
19-Apr-16 12:15pm
View
Oh I like that one ... that is slick.
leon de boer
19-Apr-16 10:18am
View
https://en.wikipedia.org/wiki/Volume_rendering
Its a very very specific scientific and computer graphic term.
People sometimes use the term voxels or surface extraction for what it is.
Now to deal with the OP.
leon de boer
18-Apr-16 15:04pm
View
You lost me that code will just put out blank or random noise?
Can I also ask what is all the enable/disable glEnable(GL_TEXTURE_2D) about?
You also seem to be missing glLoadIdentity() after glClear.
I will walk thru your code .. I will do it as a new reply so I can use advanced editing
leon de boer
18-Apr-16 4:26am
View
Retrieve the error from the glGetError function and see what it says.
If you are still using GL_LUMINANCE I might guess the format is problematic. I don't use that format ever so it's a guess but the error return will shed some light.
I Looked at your code above again and don't you just want the display window screenwidth and screenheight not the texture width anyhow?
If you aren't after the whole scene you probably need to explain more.
I mean as an alternative I would just use the Win32 API make a Memory DC as a DIB section, swap the OpenGL render context onto the memory DC, and then use the DIB section for a standard windows save.
leon de boer
17-Apr-16 23:04pm
View
These things on the animator screen are called state transitions
http://pasteboard.co/gGdYiCL.jpg
I am going to select the idle to walk backwards one (Equivalent to your walk left .. X-)
I want you to notice the condition value I have used less than -0.1f
http://pasteboard.co/gGp7zVc.jpg
Now lets look at the walk backwards to idle transition
This will have a condition of > -0.1f
http://pasteboard.co/gGxHZAn.jpg
I wont bother showing you but the transition to walk forward is >0.1f
Do you get what we are doing creating a range on our animator variable like you did in code and here they are
-Infinity <-----------------------> -0.1f Means walking backwards
-0.1f <---------0----------> 0.1f Means idle or not moving
0.1f <-----------------------> +Infinity Means walking forward
By simply organizing the animator properly your code becomes completely redundant and you just send the raw value
anim.SetFloat("LastMoveX", movement.x);
So on your game you need 3 animations walk left, walk right and an idle. Then you simply set the transitions
between them and the condition values out on the animator and you are done ... NO CODE required.
It has been like this since Unity version 4.6 and the new animator, so wherever you got the code
from is very old and predates that.
So that is the modern way to do the same thing with no code required :-)
leon de boer
14-Apr-16 20:31pm
View
Via your images you have now created the question you should have asked which is how do you make a checklistbox dropdown work like a combobox dropdown.
I can give you the answer from a Windows API perspective which is the combobox dropdown is a popup window with the style WS_POPUP it is not a WS_CHILD style that the listbox will be. The means the combobox dropdown will even float outside the dialog or windows bounds it is not clipped by it's parent. Tooltips exhibit the same behaviour they float outside there parent if required.
The solution to your problem will involve subclassing the listbox to change the style and behaviour and that is going to be outside my abilities with VB I am sorry.
Update: Knowing what to search for now I see the question has been answered in VC++ but it is outside my ability to translate that to VB. They do indeed subclass the listbox to change it's behaviour.
https://social.msdn.microsoft.com/Forums/en-US/4a43a1cc-21ec-4c04-9d85-5fbe8820d1cd/how-prevent-a-listbox-dropdown-from-being-clipped-at-the-bottom-edge-of-a-cdialog?forum=vcmfcatl
leon de boer
10-Apr-16 4:08am
View
You have no choice but to then translate the returned byte structure, carry the structure in byte form or use the [StructLayout(LayoutKind.Explicit)] operation and define matching structure to the DLL explicitly.
leon de boer
7-Apr-16 20:58pm
View
Yes that is what most games do :-)
leon de boer
7-Apr-16 9:10am
View
The only free language translator I know of is Bing Translator which is free for over 1000 pages (2 million characters) per month. I have never used it.
However the website https://www.bing.com/translator/Help gives details about how and what you can integrate it into. Probably start there and ask around. It does say you can use the translator directly using the Windows and Windows Phone apps so search MSDN for examples.
Update: C# code for putting it in an application titled "Walkthrough: Writing a Windows 8 Translator App"
http://blogs.msdn.com/b/translation/p/windows8walkthrough.aspx
Also found the cost details for you https://www.neno-translate.com/en/blog/48-best-machine-translation-api which gives you the cost and volume breaks.
leon de boer
6-Apr-16 23:44pm
View
You obviously have never played with OpenGL ... FULL SCREEN can change the screen resolution it is called "resolution" and why you are blatantly wrong and I am taking you to task over your answer.
The HeNe tutorials set 640 x 480 and 16 colour mode OF THE ENTIRE SCREEN by this line and the whole windows desktop goes bye bye .. no more desktop. There is no desktop and no normal windows resolution at this point.
CreateGLWindow("NeHe's Solid Object Tutorial",640,480,16,fullscreen))
Most people don't run windows in 640x480 mode but when you run the app it swings the screen to 640x480 and the resolution is 640x480 I assure you that is the resolution.
If you don't have familiarity with OpenGL in fullscreen mode before commenting probably play with the NeHe examples which do indeed set the whole screen to 640x480 resolution
I just built lesson5 from Nehe if you want to try it tell me what resolution it takes your screen to in fullscreen mode .. here is the link
http://s000.tinyupload.com/?file_id=00368581431374272263
You should see then what we are saying and why your answer is so badly wrong.
I play world of warcraft and I use this full screen mode opengl on the client always because in windowed opengl mode the performance hit is to great. It's a common interface mode for high end graphics games and graphical applications.
leon de boer
6-Apr-16 22:57pm
View
That is totally wrong he is using a FULL SCREEN APP he can choose any resolution he chooses that the monitor/adapter supports. I will deal with him in how to control it.
leon de boer
6-Apr-16 8:59am
View
If you are simply drawing the font glyphs there is a bunch of win32 API and microsoft class libraries to draw the beziers directly
Win32 API start with the function PolyBezier
https://msdn.microsoft.com/en-us/library/windows/desktop/dd162811%28v=vs.85%29.aspx
The graphics class contains bezier drawing
https://msdn.microsoft.com/en-us/library/windows/desktop/ms533926%28v=vs.85%29.aspx
Finally if you do really want to draw it all manually then you will need to explain what you are trying to do. Example here is an Arial letter B glyph I have draw using the win32 API. The green nodes are on grid points the yellow off grid.
http://s22.postimg.org/4yvej9f5t/Arial_B.jpg
The approximated drawing can be based on arc length, offset accuracy, speed, uniform spacing and a raft of other criteria. At its heart bezier drawing is an approximation process and we can't guess what your criteria for the approximation needs to be. So the "best way to draw a bezier" is not a defined question without giving us more criteria detail.
You need to explain exactly what you are trying to do.
leon de boer
14-Mar-16 12:03pm
View
Yes it's outdated but unity will patch it all for you. The section manager code is what I am trying to get you to understand and you have to do for an infinite runner. You have 3-5 segments the middle one is the one your player is currently on. In your one he is running right so as a segment gets too far left (it's off screen anyhow) you delete it releasing all the memory on the objects that was on it. You create a new one at the far right (its off screen as well) and some time later you will run onto that one.
The easiest way to explain is watch what is happening is drag the scene window out, so you can see it while playing that game and look closely what is happening on the scene view with segments and you will understand it.
I have made you a simpler demo code download from http://s000.tinyupload.com/?file_id=24020917261579845135
It's all procedural generated so just press start.
I have just created 3 coloured plane prefabs that will be randomly selected. Walk forward and you will get the idea. I made the back arrow deliberately not move the character but move the terrain so you can see it is the terrain moving not the character. It is just two simple scripts one animates the character and the second does everything with the terrain.
Add things onto the coloured prefabs and you will get the idea of the random prefabs. That it one infinite runner.
Your monster spawns etc simply go on each prefab
leon de boer
14-Mar-16 4:11am
View
Can I check you are really not making your world truely infinite. Unity will throw warnings when you reach a coordinates >100k and crash sometime shortly after and long before that it will indeed slow up and starts chugging because your world is simply too massive on memory.
You need to use a blocks or levels approach so you contain the world to a reasonable size
The usual approach is the treadmill or stage approach. 3-4 blocks one behind you (your history), the one you are on, the next block or possibly 2 for speed to appear
You need to make the block or stage move under your character who always stays at (0,0,0) and when a block moves off screen delete it. If everything in your stage or block is a child of the ground plane you can simply move the ground plane and all the children move with it.
It's overkill for you but there is a free infinite runner kit on asset store (https://www.assetstore.unity3d.com/en/#!/content/12324)
This shows the block or sections one highlighted .... http://s14.postimg.org/3tyjo7qw1/endless1.jpg
This is what the player sees .... http://s12.postimg.org/3rxwnmbgd/endless.jpg
leon de boer
13-Mar-16 9:18am
View
Isn't your spawn script on an empty gameobject child infront of your character?
The setup for an infinite runner would be
Camera behind ----------- Player ---------------- Spawnpoint infront
I posted what that looks like here
http://s18.postimg.org/k4h1zyzft/Run_Set.jpg
I would have the spawn script on the empty spawnpoint object and simply put a trigger collider on it.
I assumed 3D here for 2D the camera will be on the side obviously but regardless the question is what gameobject have you put your spawn script on.
The other curious question, your code only shows the spawns being destroyed if they collide with player what removes them if they don't hit the player? I assume you have code to clean then up when they go offscreen or a certain time after spawning.
leon de boer
11-Mar-16 22:45pm
View
When doing endless spawning the tricky part is to decide where to spawn them because of this issue of spawning them ontop of each other, other objects and the players. On way I may suggest for you is that your spawn point has a trigger collider and only when the spawned monster moves thru the trigger does the invoke to the next spawn start. I assume your spawn script is just sitting on a simple game object point so put a trigger collider on it and an ontrigger code like on the destroyer script.
Try it without destroying parent .. all it should need is this
void OnTriggerEnter2D(Collider2D other){
if (other.tag == ("Player"))
{
Debug.Break();
return;
}
Destroy(other.gameObject);
}
leon de boer
11-Mar-16 4:16am
View
Are you sure of screen numbers? your destroyer script only works on collission.
Anyhow why do you instantiate them all at the one point being ===> transform.position
Without really knowing what you are trying to do hard to suggest but I guess count what number spawn you are at and create a new spawn position based on the count something like
Vector3 newSpawnPoint = transform.position; // Copy transform.position to a temp variable
newSpawnPoint.x = objCount * 1.0f; // Now offset x value by 1.0f * objCount (some offset value)
Instantiate(obj[Random.Range(0, obj.GetLength(0))], newSpawnPoint, Quaternion.identity); // Spawn at the new spawn offset position
CAN YOU ALSO EXPLAIN THIS IN DESTROY SCRIPT
if (other.gameObject.transform.parent){
Destroy(other.gameObject.transform.parent.gameObject);
} .....
That basically says if your object has a parent destroy the parent. I don't see where you parent the spawned object object so lost as to why you do it rather than just have the bit inside the else statement
leon de boer
17-Jun-14 20:07pm
View
Perhaps read the basics in wikipedia (http://en.wikipedia.org/wiki/USB)
There are current resistors needed to detect the draw of the device and protect against over draw which was the problem with the old 1.0 USB ports is they would be physically killed if you shorted them because the 5V rail was raw.
Wikipedia covers the main changes to the USB physical interface and you will note 1.1 got actually overlooked in 2.0 and back in to spec in 3.0 although I have never seen a 2.0 device chipset without it.
Quote = "Battery Charging Specification 1.1: Released in March 2007 (Updated 15 Apr 2009).
Adds support for dedicated chargers (power supplies with USB connectors), host chargers (USB hosts that can act as chargers) and the No Dead Battery provision, which allows devices to temporarily draw 100 mA current after they have been attached. If a USB device is connected to dedicated charger, maximum current drawn by the device may be as high as 1.8 A. (Note that this document is not distributed with USB 2.0 specification package only USB 3.0 and USB On-The-Go.)"
Quote = "Link Power Management Addendum ECN: Released in July 2007.
This adds "sleep", a new power state between enabled and suspended states. Device in this state is not required to reduce its power consumption. However, switching between enabled and sleep states is much faster than switching between enabled and suspended states, which allows devices to sleep while idle."
If you go forward from that to USB 3.0 spec you will find the voltage and power draw are even now negotiated at device startup.
So the power supply to the port of a modern USB is nothing like a raw +5V rail it is front ended thru detection and protection circuitry in the USB chipset so it could detect what it calls a "standard load".
So on any of the major chipsets used for USB the power supply comes out of the chipset so I will randomly take one lets say cypress (http://www.cypress.com/?docID=33237). No initialize the chipset = No power to USB.
Anyhow the bottom line here is you can test it easily this get a dumb USB peripheral like a coffee warmer or lights or one of the millions of stupid USB toys that actually isn't actually a device but just using the power rail and then simply go to control panel in windows and remove the USB driver and watch what happens.
There is most definitely power to the USB like you describe IF AND ONLY IF the USB chipset is up and running normally because they need to make sure the protection circuits are in place which is usually monitored from within the chipset and the power rails to the USB come from the chipset itself. Every USB chipset I know of on the market will only power the USB port rails to a USB port if the chipset is initialized and enabled it would not be safe to do it any other way.
So you are correct when everything is up and running normally and the USB chipset is initialized and enabled.
Now if you read the response from the poster the clients machine clearly does exactly the above because the code the client found fixed his problem and the client was asking the poster to implement the function in his code. The posters problem was simply he couldn't understand how the clients code worked which I think we have covered now the how and why the clients code works.
leon de boer
8-Jun-14 9:04am
View
Are you sure the file actually opened you don't check the return from the open?
fd = open("miafifo",O_RDONLY);
fd may or may not be valid you never check the return value of the file handle.
leon de boer
8-Jun-14 0:48am
View
Seriously you cant see the problems of which there are three, what I was suggesting would be interesting to watch that line in the debugger :-)
1st error: strng--;
strng is pointing to the start of string ... you know it does because you used it with strlen to get it's length
so strng--; goes to I have no idea some random location in memory that is one before the allocated string memory
I assume you wanted the last character so it should have been strng = &strng[length-1];
2nd Error: strng2 gets asciiz termination exactly how?
You even noted that length doesn't include the asciiz termination character and YOU NEVER ZEROED strng2 after memory allocation so how do you think it is ever going to be asciiz terminated.
3rd error: strng is never allocated you allocate memory for strng2 but not strng therefore the program may even crash at the "gets" command because strng will be just a random value.
Look at the "gets" documentation the passed in value HAS TO BE MEMORY THAT IS ALLOCATED either malloc it like you did strng2 or assign strng as an array here is the reference on "gets"
http://www.cplusplus.com/reference/cstdio/gets/
NOTE the sample
char string [256];
gets (string);
Your options are use like the above or use the dynamic allocate alternative:
char* strng;
strng = (char*) malloc(256);
gets(strng);
Now finally a question any reason you are using Dev-C I don't think it's even supported anymore is it? You know you get microsoft VS 12 and 13 express are free if you aren't doing commercial development all you do is open a microsoft account with your e-mail it's a bit more up to date. The project settings might do your head in a little at start but that is just a matter of going thru one of the online blogs on setting up your first project.
VS 12 and 13 both correctly pick up error 3 and report it, no compiler will pick your first two errors :-)
main.cpp(588): warning C4700: uninitialized local variable 'strng' used
leon de boer
6-Jun-14 21:26pm
View
All I can say is you have made an error on your firewall rules or the listener thread for port 443 is not open to the outside world.
If you want to check it on the server machine use this link "https://www.grc.com/x/portprobe=443", that is Gibson research port probe server and if it's open it will tell you. It has to report as opened or it isn't going to work. That will at least make sure that side of it is okay.
If it comes back closed or stealthed you need to find the problem on the server listener machine and I am guessing you are going to get one of those two rather than the open state.
leon de boer
6-Jun-14 7:45am
View
He is correct I left the pointer "*" out in the final line it should be
*((uint32_t*)&cast1[5]) .... Simple typo error because it's sort of a naff way to write it.
The reasoning is simple
&cast1[5] is a pointer to a uint8_t
(uint32_t*) is required to stop the compiler warning because the above pointer is to a unit8_t and it is going to a uint32_t it will work but with a compiler warning.
*(...) is the dereference to the bit in the brackets
So the complete thing and final line should have been:
uint32_t x = *((uint32_t*)&cast1[5]);
The logic above is exactly what the compiler does but as I said it's hard to human read and easy to make errors like I did. That is why the dummy pointer is the much better and more standard way to do it.
Whichever way you go typecasting is dangerous and you need to use only when absolutely needed.
leon de boer
29-May-14 9:37am
View
That is actually the best solution and it answered the other question I had which was how did they put the icon there and that answers that because you have the icon options in the EDITBALLOONTIP structure under ttiIcon. I voted it a 5 nicely done it's very neat.
It does give me something I am going to have a look at in it's underbelly however which is how they have shaped the window because it clearly doesn't work off a bitmap mask because it changes when it gets close to the edges. So I am guessing it's a poly shape they mathematically create and use much like I made the button in that validate sample. Something to ponder and play with because there may be some more interesting subclass plays to be had here.
leon de boer
28-May-14 11:16am
View
Ok now I get exactly what you are trying to do let me see what I can do with it, not tried this but it shouldn't be hard
leon de boer
18-May-14 10:15am
View
You are welcome one final comment I hope you restricted the QSort down to the number of actual valid customer records there is no point sorting what is empty and unused customer records it just wastes time.
leon de boer
16-May-14 23:47pm
View
It's easy but you can't work it out :-) I will tell you what I know which is limited because this rubbish annoyed the hell out of me.
You take your GLuint and you end up creating your 2D image by using glTexImg2D which carries two parameters which are glTexCoord2d and are numbers ranging from 0 to 1, so 0.5 is half way along the image etc. This for me created the first set of problems in that you can't nominate a pixel width so you need to pad the space between your images to allow for rounding errors especially if the two textures in side by side are very very different. The official line is "This has the advantage of being size-independent"
So when you are in OpenGL forget about pixels and widths, heights everything is a number between 0 and 1.
I have seen some sidestep the issue by loading JPG,BMP, PNG etc to a standard Win32 bitmap and then create a DIB section off it and pass that to the create texture in OpenGL like you are doing. In other words they do all the bitmap slice and dicing down on the Win32 API and simply pass the result out to OpenGL.
So get thru that and lets see which of the problems you run into next.
leon de boer
7-May-14 11:14am
View
Same deal the standard treeview does not quite come out how you want
This is what you get ==> http://s14.postimg.org/77gti4pj5/treeview.jpg
You would have to do some work to get exactly what you want it would involve make your own 3 state check box images unticked ticked and blank empty area. Then you would have to handle the checkbox message yourself.
There is a sample of doing this trick here => http://www.codeproject.com/Articles/6549/Tri-State-TreeView-Control unfortunately C# but it is calling back directly to the Win32 API
leon de boer
7-May-14 4:44am
View
As per the others have said the minimum we need is the definition of the structures maillon and noeud.
The procedure allouer which takes a pointer to a maillon structure and does something to it.
The procedure profondeur which takes a pointer to noeud and returns a level of a node apparently.
Without those I doubt anyone can help you
leon de boer
6-May-14 9:10am
View
WM_MOVE and WM_SIZE are for 16 bit windows code and you are on Visual Studio you can't build a 16 bit app.
The font will leak memory in it's current form I created a font through create font indirect so it needs to be deleted. Do you know the easy way to do that by property attachment and cleaning it up at WM_DESTROY or do you need me to show you?
In it's current form you probably need to pick off WM_SETFONT and do the same check to make sure they don't give you a ClearType font so taht is another bit of house keeping.
I actually haven't given up on ClearType it is solvable I just needed more time and didn't want to hold you up so I will post you a more final solution.
The problem with downloading the code must be something with you and code project I will put it up on a publci FTP site when I get a moment and give you the link.
leon de boer
6-May-14 5:11am
View
BTW I don't just work in C I do C++ a lot as well, I use C if I intend to use the code on embedded systems :-)
Now your problem is rather simple when you create the transparency mask it is on 1 bit so black or white. What you really want is a mask that selects a specific color because what is happening at the moment is middle colors like gray can be masked or not masked depending how light or dark they are .. do you understand why?
Specifically on the Treeview you want to mask of a specific color being white RGB (0xFF, 0xFF, 0xFF) you don't want colors that are close to but not exactly white being masked off. What the clear type does is puts lots of these middle colors (light and dark grays) out and your mask process kills them and hence your font display looks very very ugly
So give me a minute and I will see if I can fix it.
leon de boer
5-May-14 11:55am
View
Yes that is correct?
The only two issues I can see are the min/max are not reached which most likely means you have not scaled your analog input properly. You could easily check that by disconnecting the input and manually connecting it to gnd somewhere and check the code starts spitting 0 and then connect it to +5V rail and see if it starts spitting 325.
The other issue it possibly looks like there may be timing problem because it isn't following a sinosoid but that could also be the above problem. However it could also be a timing problem and I would really like to see what the code in the function
Delay_Cyc(3); //wait acquisition time
look like
leon de boer
5-May-14 11:17am
View
If you would like me to look at it put the zip up the code on the net somewhere and I will have a quick look.
leon de boer
5-May-14 3:25am
View
I will need to write some code and post up for the complete draw and I don't have time right this minute so will get back to you on that one.
However drawing the rectangle is simple you have a DC called FinalDC it doesn't matter that it's a memory DC windows doesn't care it still draws on it like it is the screen.
So simply select a pen and brush onto the DC and draw a rectangle over the text that is cause int the problem and then do a TextOut over it .. you know the usual make a pen and brush and use them
SelectObject(FinalDC, Pen);
SelectObject(FinalDC, Brush);
Rectangle(FinalDC, x1, y1, x2, y2); /// x1,y1 & x2,y2 are local cordinates to block out offending text
TextOut(FinalDC, x1, y1, Txt, TextLen); // write your text over the area you cleared
Now BitBLT your final bit as usual.
By the way did you see the other code I did to explain number entry subclassing
http://www.codeproject.com/Tips/767325/Validating-Window-Controls-by-Subclassing
leon de boer
5-May-14 1:47am
View
Be more specific what problem you should be definitely getting values between 0-325 no other option is possible assuming your UART1_Write_Text routine works.
leon de boer
4-May-14 20:36pm
View
I would have simply painted the whole area myself rather than try to use Microsoft's draw at all which is likely to change anyhow.
That said if you really want to stay with you current scheme can't you simply put rectangle over the area the text is currently in on the memory DC and then write your own text over the now solid clear area?
leon de boer
4-May-14 10:46am
View
Download my test app and just run the compiled EXE and load your image and vectorize them. Here let me do a triangle for you
original image: http://postimg.org/image/vteq9h5o1/<br>
Here is the result of my app: http://postimg.org/image/l6yqwvj5r/
However zoom in (the ability to go x9) is on the app:http://postimg.org/image/zeyhy30f9/
See the jaggies I am assuming you don't want them so what you need is line detection post the vectorize process.
leon de boer
4-May-14 9:09am
View
Deleted
Then GeeksforGeeks to the rescue :-)<br>
http://www.geeksforgeeks.org/implement-itoa/<br>
Code for the function is available ... enjoy<br>
You find code for most of these standard sorts of routines everywhere on the net.
leon de boer
29-Apr-14 14:12pm
View
The thicker border is caused because the gray from the old background still remains when you delete the letter r.
Simply invalidate the whole window to force the window to redraw to fix it by using
InvalidateRect(hWnd, NULL, TRUE);
I am currently preparing a full article to put on codeproject to show you a much more elegant way to do all that with a subclass and it works in a dialog or standard window without change and automatically calls a validate procedure if you require.
leon de boer
28-Apr-14 8:58am
View
Deleted
Perhaps read the next line
<pre>The DWL_MSGRESULT value set by the SetWindowLong function is ignored.</pre>
Want to guess whats in the DWL_MSGRESULT that is now going to be ignored when you return false????
Yes the default handler gets called but there is no valid brush.
I have no idea what microsoft's intention was with this but the simple solution from where you are is to simply call the default handler yourself manually while DWL_MSGRESULT is still valid.
It has been like that for a very very long time, perhaps it's a bug or oversight I just know it works.
Realistically for commercial products most of us subclass the standard edit box for types of entries with the edit boxes handling there own validation, tabbing etc. It means far more reusable code and much less playing around with dialog handlers in many cases you can just use the standard dialog handler.
leon de boer
28-Apr-14 6:38am
View
Deleted
I understand your edit is the a dialog but your code doesn't work does it :-)
So please read the very next line after what happens if you return false.
>>> The DWL_MSGRESULT value set by the SetWindowLong function is ignored. <<<
Do you know what is in the DWL_MSGRESULT ... can you guess?
Here is what actually happens in a dialog message handler
http://blogs.msdn.com/b/oldnewthing/archive/2003/11/07/55619.aspx
This is a well know behaviour yes your message is handled by the default handler but you lost your default brush :-)
As I said the simple solution is don't return false and call the default handler yourself directly while DWL_MSGRESULT is still valid.
Don't ask me why Microsoft made it like that but it has been like that for as long as I can remember.
leon de boer
27-Mar-14 0:19am
View
The post is very specific about what he wants there is nothing vague about it the word automatically is probably the only vague part.
You and the other idiot posts seem to troll around the word "create" for opening a port well if you think hard you need to take that issue up with Microsoft you have not opened a serial port in a very long time.
You use CreateFile and CreateFileEx to open an already existing file for reading and in many cases the file is actually read only. For a com port under win32/64 framework with exactly the same routines the specific open com port routines long gone. We could also add you can now also have virtual com ports which really are created and the like but it's just fluff to the answer.
So perhaps take your troll jokes to Microsoft because of the above "creating" a com port has become standard terminology and if you don't realize that and why perhaps the joke is on you.
leon de boer
2-Mar-14 23:45pm
View
I think what you are after we have already put up in demo code in the tips section
http://www.codeproject.com/Articles/407172/Connected-Component-Labeling-and-Vectorization
The correct name for what you are trying to do is called connected component labeling, it labels and/or colors connected blocks.
Show More