Pages

Friday, May 26, 2017

Add CURL in Visual Studio (C++) easy, not bullshit, works

Looking for something that fixes your day because you are having a nightmare with CURL or libcurl? Tired of finding just stupid tutorials in the internet that never work or are crazy complex? Lets cut the bullshit.

I'm not telling you what CURL is now, but I'll tell you this shit is tricky to implement. I'll try to show you from the very beginning. In my case I used Visual Studio 2012, C++ and CURL 7.54.0.

To start, I'll tell you, you can't download from the official website (nor from fucking anywhere, as it seems) what really needs to implement CURL. What you get are the files for building the other files that are the good stuff. I had to build mine ones so I'll give you a link to download them, though I don't really know if these work for everyone (I presume they do). Anyway, I'll show you how to build your own ones, so jump to the implementation part if you use my stuff.


Building

This is to build the files you need to import to your project.
First, download the zip from the CURL site, get the file from the section "Source Archives".

https://curl.haxx.se/download.html

1. Extract them somewhere and go to the folder "winbuild". Copy the path to that folder.
2. Go to your programs and find "VS2012 x86 Native Tools Command Prompt" or you equivalent.
3. Run it and cd to the path to the point 1. For that, write: cd pasteHereThePath and press enter.
4. Now write the following: nmake /f Makefile.vc mode=static VC=12
5. Change the number 12 for the number of your Visual Studio version. E.g. VS 2015 then VC=15. Press enter

Now it should start the building. Wait.

In the folder where you extracted the zip file, a new folder called "builds" must have been created. Follow this paths to find the results of the build:
builds/libcurl-vc12-x86-release-static-ipv6-sspi-winssl/include here is the "curl" folder
builds/libcurl-vc12-x86-release-static-ipv6-sspi-winssl/lib here is the .lib file

6. Get the "curl" folder and the .lib file called "libcurl_a.lib". Forget every other file.

Implementing

Now that you have the folder and the .lib (I recommend moving the file into the folder), put then somewhere reasonable for your project (I assume you already created a VS project), for example in the project root folder.

To get VS to work with the new files, we must tune some options:

1. In the "Solution Explorer", right click in your project and click "Properties".
2. Go to "Configuration Properties" -> "VC++ Directories". In the fields "Include Directories" and "Library Directories" add the path to the curl folder and to the .lib respectively. If you followed my advise, the folder must be the same for both. It's also a good idea to use relative paths or macros, but now it's not time to go into details.
3. Go to  "Configuration Properties" -> "Linker" -> "Input". In the field "Additional Dependencies" add the name of the .lib file: "libcurl_a.lib"
4. Go to  "Configuration Properties" -> "C/C++" -> "Code Generation". In the field "Runtime Library"select "Multi-threaded DLL (/MD)".
5. Click OK and move on.

There you have it, after all this, you must be able to create a .cpp file and include "curl.h" without trouble. Here are examples of code, by the way: https://curl.haxx.se/libcurl/c/example.html

Tell me in the comments if this was of any help to you.

Tuesday, October 25, 2016

Fix USB to TTL cable driver problem Windows 8/8.1

I bought this stupid thing from Ebay instead of the classic without cable because so I don't need to use more wires.

TTL-USB cable picture stolen from ebay

The thing was I couldn't make it to work in Windows 8.1. I discovered it is based on a Prolific chip and that there were a series of those which weren't supported by W8 nor W8.1.

Shit Prolific says in its website
Guess what chip I got.

Prolific CheckChipVersion saying I bough shit
Yes, I got a 'cursed' one, of course.
Eventually, I made it to work with the following driver. It should work for W 7/8/8.1/10.

https://mega.nz/#!pYMn2Yoa!qFwnpJurRuAvmB1mznQg174R23Ruxqb_rqlNSoir4nI

Fuck yeah.

Tuesday, June 28, 2016

Tesla Motors doesn't care about privacy

I'd like to say that the original title of this article is 'Tesla Motors is bullsit', but for better Google positioning so more people can know, I specified a little bit.

Tesla Motors's fancy electric toys must be great expensive fun but there are a lot of things to worry about with those wheeled smartphones. 

It is completely astonishing the crazy amount of data they spy from you. What comes to your mind? What's what would worry you? Your current location? Your speed? Of course they collect that and much more! They even log when you honk! And you know what? They are not selfish, the are ok to share with other companies.

They can also control your car remotely, by the way.

It has been a surprise for me to find that everybody can access a dirty list with these things in their website:

https://www.teslamotors.com/about/legal?_ga=1.55288493.704186209.1467073573#privacy-statement

But I feel better if I paste the content here, let's say for the records. Enjoy.





We may collect personal information in a variety of ways, including:
  • Through the Services: We may collect personal information through our websites, software applications, social media pages, e-mail messages, or other digital services (the "Services"), e.g., when you sign up for a newsletter or make a purchase.
  • From other sources: We may receive your personal information from other sources, such as public databases, joint marketing partners, and social media platforms.
  • My Tesla: Customers who purchase a Tesla vehicle will receive a My Tesla account, which is hosted on our website. We may collect and process the following types of data for your My Tesla account that you elect to provide to us: your customer registration information; the status of your vehicle order; warranty and other documentation for your vehicle; and general information about your vehicle (including vehicle identification number, service plan information, connectivity package, and other personalized details such as Internet radio account information), insurance forms, driver’s licenses, and financing agreements.
  • Telematics Log Data: To improve our vehicles and services for you, we collect certain telematics data regarding the performance, usage, operation, and condition of your Tesla vehicle, including the following: vehicle identification number, speed information, odometer readings, battery use management information, battery charging history, electrical system functions, software version information, infotainment system data, safety‐related data (including information regarding the vehicle’s SRS systems, brakes, security, e‐brake), and other data to assist in identifying and analyzing the performance of the vehicle. We may collect such information either in person (e.g., during a service appointment) or via remote access.
  • Remote vehicle analysis: We may be able to dynamically connect to your Tesla vehicle to diagnose and resolve issues with it, and this process may result in access to personal settings in the vehicle (such as contacts, browsing history, navigation history, and radio listening history). This dynamic connection also enables us to view the current location of your vehicle, but such access is restricted to a limited number of personnel within Tesla.
  • Other vehicle data: In order to help improve our products and services, we may collect and store data about accidents involving your Tesla vehicle (such as air bag deployment) and the following types of data: data about remote services (such as remote lock/unlock, start/stop charge, and honk-the-horn commands); a data report to confirm that your vehicle is online together with information about the current software version and certain telematics data; data about any issues that could materially impair operation of your vehicle; data about any safety‐critical issues; and data about each software and firmware update. We may collect such information either in person (e.g., during a service appointment) or via remote access.
  • Service history: We collect and process data about the service history of each Tesla vehicle, including the customer’s name, vehicle identification number, repair history, any outstanding recalls, any bills due, any customer complaints, and any other information related to its service history.
  • Charging station information: We collect information regarding the charge rate and charging stations used by you (including outlets) in order to analyze which charging stations are being utilized, how long and efficient battery charges are, and where additional charging stations are needed.
  • Offline: We may collect personal information from you offline, such as when you visit a Tesla store or repair facility, attend one of our tradeshows, sign up for a test drive, place an order over the phone, or contact our customer services or sales department.

How We May Use Personal Information

We control access to personal information, including taking steps to restrict access to personal information to individuals within Tesla who need such information to perform their jobs and are bound by enforceable confidentiality obligations. We may use personal information for a variety of reasons, such as those listed below:
  • To respond to your inquiries and fulfill your requests, such as to send you newsletters or product information, vehicle information alerts, or brochures.
  • To set up, evaluate, and provide feedback regarding a test drive.
  • To complete and fulfill your purchase, for example, to process your payments, have your order delivered to you, communicate with you regarding your purchase, and provide you with related customer service.
  • To provide service to your Tesla vehicle, including to contact you with service recommendations and to deliver over-the-air updates to your vehicle.
  • To advise you of important safety-related information.
  • To send administrative information to you, for example, information regarding the Services and changes to our terms, conditions, and policies.
  • To monitor your Tesla vehicle’s performance and provide services related to your vehicle.
  • To present products and offers tailored to you and to enhance our lists with information from other sources.
  • To allow you to participate in contests and similar promotions and to administer these activities.
  • To facilitate social sharing and communications functionality.
  • For our business purposes, such as: data analysis; audits; fraud monitoring and prevention; developing new products and services; enhancing, improving, or modifying our products and services, including our vehicles, vehicle technology, and related services; identifying usage trends; determining the effectiveness of our promotional campaigns; and operating and expanding our business activities.

How We May Share Personal Information

Personal information we collect may be disclosed to third parties when necessary to perform services on our or on your behalf, including the following:
  • To Tesla affiliates for the purposes described in this Privacy Policy. Tesla affiliates are companies that are owned or controlled by Tesla Motors, Inc. and companies in which Tesla Motors, Inc. has a substantial ownership interest.
  • To our third party service providers to provide services such as website hosting, data analysis and storage, payment processing, order fulfillment, wireless connectivity to Tesla vehicles, information technology and related infrastructure, customer service, vehicle maintenance or related services, e-mail delivery, credit card processing, auditing, marketing, and other similar services.
  • To third party service centers if you choose to utilize them. Note that some personal information is stored on the Tesla vehicle and may be accessible directly to the third party service centers that you choose to utilize to diagnose or service your vehicle.
  • To other third party business partners to the extent that they are involved in your purchase or the service of your Tesla vehicle or related products. We share limited personal information to allow you to take advantage of those services if you elect to utilize them, with such partners as finance, leasing, registration, and title companies.
  • To third-party sponsors of contests and similar promotions, if you elect to participate.
  • To your employer or other fleet operator or the owner of the Tesla vehicle, if you do not directly own it and as authorized under applicable law.
  • To your social media account provider, if you connect your Services account and your social media account. If you do so, you authorize us to share information with your social media account provider and you understand that the use of the information we share will be governed by the social media account provider’s privacy policy.
  • To a third party in connection with any reorganization, merger, sale, joint venture, assignment, transfer, or other disposition of all or any portion of our business, assets, or stock (including in connection with any bankruptcy or similar proceedings).
  • Tesla may transfer and disclose information, including personal and non-personally identifiable information, to third parties to comply with a legal obligation (including, but not limited to, subpoenas); when we believe in good faith that the law requires it; at the request of governmental authorities conducting an investigation; to verify or enforce our policies and procedures; to respond to an emergency; to prevent or stop activity we may consider to be, or to pose a risk of being, illegal, unethical or legally actionable; or to protect the rights, property, safety, or security of the Services, Tesla, third parties, visitors to our Services, or the public, as determined by us in our sole discretion.
We do not share your personal information with unaffiliated third parties for their marketing purposes unless you opt in to that sharing.

How We May Collect or Share Information That Does Not Personally Identify You

We may also collect and share information that cannot, on its own, be used to identify you. We and our third party service providers may collect such information in a variety of ways, including:
  • Through your vehicle: We may provide you with features in your Tesla vehicle, such as the real-time traffic feature, which make use of the true road segment speed of your vehicle, and we may share this data with partners that contribute similar data to help us provide the service. However, we only collect and share this data if these features are available in your vehicle and if you elect to use them, and we only collect and share this data in a way that does not personally identify you or your vehicle. We also do not collect the beginning or end of your trips. We also may collect similar data in connection with other features and may share it with business partners where necessary to provide the feature to you, but we will only collect and share the data in a way that does not personally identify you.
  • Through your browser or device: Certain information is collected by most browsers or automatically through your device, such as your Media Access Control (MAC) address, computer type (Windows or Macintosh), screen resolution, operating system name and version, device manufacturer and model, language, Internet browser type and version, and the name and version of the Services (such as the Tesla App) you are using. We use this information to ensure that the Services function properly.
  • Using cookies in connection with your My Tesla account and our website: Cookies are pieces of information stored directly on the computer that you are using. Cookies allow us to collect information such as browser type, time spent on the Services, pages visited, language preferences, and other web traffic data. Our service providers and we use the information for security purposes, to facilitate online navigation, to display information more effectively, and to personalize your experience while using the Services, as well as for online tracking purposes. We can recognize your computer to assist your use of the Services. We also gather statistical information about the usage of the Services in order to continually improve their design and functionality, understand how the Services are used, and assist us with resolving questions regarding the Services. Cookies further allow us to select which of our advertisements or offers are most likely to appeal to you and to display them to you. We may also use cookies in online advertising to track responses to our advertisements, and we may use cookies or other files to track your use of other websites.


Tuesday, June 21, 2016

Fix Windows Phone 8/8.1 backup error

So you want to make a backup of your phone settings, apps or whatever, in the way Microsoft calls 'manual', which is entering backup > app+settings and pressing 'back up now' and you get the stupid error 'There was a problem backing up your settings. Try again later'.

Picture stolen from Microsoft Support forum
The old trick of deleting the old backup worked once but not anymore?

Here is the fix:

You have a buggy version of Windows Phone and you have to update it in order to back up without the error.

Probably your phone does the backup OK and you can find it browsing with the computer the Onedrive website. You'll find a backup with the date of your last 'erroneous' backup in the proper section of the web.

So check for phone updates and proceed. Don't worry for data losses, your data will be back after the update despite of backup error.

Fix Photostream error for Windows Phone

If you use Photostream for changing your lock screen wallpaper periodically and after some update you get the stupid 'there was an unspecified error while trying to retrieve the photo' message when you try to add a new picture source, then here is a trick that worked for me.

- Go to your lock screen settings. It depends on your Windows version how to get there.
- If 'Photostream' is selected as background, change to another thing like 'My picture'.
- Open Photostream and follow the instructions that will pop up.

If the app crashes during this process, start again.

Monday, April 11, 2016

Matlab 2014 Simulink stupid connector errors

You start Matlab, start Simulink, and the moment you run any simulation you get a big pile of shit similar to this:

Error using connectorHandler>performAction (line 77)
Error starting MATLAB Connector. Please check that port 31515 is available.
 Error in connectorHandler (line 32)
   Error in connector (line 14)
    [isRunning, hostInfo] = connectorHandler(action, varargin{:});
 Error in connector.ensureServiceOn (line 22)
   Error in slmsgviewer (line 58)
   Error in slmsgviewer/PersistentInstance (line 304)
   Error in slmsgviewer.processRecord (line 404)
  
Error using connectorHandler>performAction (line 77)
Error starting MATLAB Connector. Please check that port 31515 is available.
 Error in connectorHandler (line 32)
   Error in connector (line 14)
    [isRunning, hostInfo] = connectorHandler(action, varargin{:});
 Error in connector.ensureServiceOn (line 22)
   Error in slmsgviewer (line 58)
   Error in slmsgviewer/PersistentInstance (line 304)
   Error in slmsgviewer.processRecord (line 407)
  
Error using connectorHandler>performAction (line 77)
Error starting MATLAB Connector. Please check that port 31515 is available.
 Error in connectorHandler (line 32)
   Error in connector (line 14)
    [isRunning, hostInfo] = connectorHandler(action, varargin{:});
 Error in connector.ensureServiceOn (line 22)
   Error in slmsgviewer (line 58)
   Error in slmsgviewer/PersistentInstance (line 304)
   Error in slmsgviewer.processRecord (line 404)


This happened to me running Matlab 2014a, but probably it's the same for older and newer versions. 

The people of the internet only spoke unhelpful bullshit about Java versions, so I had to take this seriously and work this out by myself.

If you have a firewall stopping Matlab's network connection (which I had, considering my copy is pirated) then that's your problem. Matlab needs the internet to work without complaining, for reasons no one here cares. So, create a rule or disable your firewall while using it and there you go. As far as I know, there's no mess with the activation.

Also, as far as I tested, I believe that Simulink works properly despite of the errors.

Monday, January 11, 2016

Hi-Fi Headphone Amp

Long after the Headphone Bass Booster I did another amp!



This time, the reason for this project was the stupid powerless soundcard built in laptops. You can fry your ears with treble but when it comes to bass it's worthless and annoying. I looked for some second hand headphone amps without luck and I disliked the price of brand new ones. There are lots of speaker amps second hand with headphone output, not very expensive, but I didn't have room for those big ones. Eventually, I decided to make one myself with reused parts, for free.

As usual, this isn't intended to be a tutorial, but I'll post some pictures to show you.



After the design and test stage it was time to put everything on a PCB.



The project is based on a Philips TDA1521 from an old TV. This IC is a Hi-Fi 12W amp with plenty of power for the purpose. I read good opinions about those TDAs, and they're easier and better than op amps. It was required a good power source however, which was the biggest problem to solve. Fortunately, a relative donated to me a laptop adapter (switching PSU, 19V, 4A), with more than enough power.



I knew I had room in the case, so I included a ferrite bead in the input to help with the high frequency noises that can come from bad filtered PSUs and reach the audio stage in laptops.



I'm no master at crafting I know, so the case parts fitted poorly (you'll see later). I didn't have many power tools either, so it was awful and tedious to fabricate. Actually, the aluminium cover (from an old VHS player) took 478965423667 hours to complete.



I added a big heat sink and some paste for the cooling system. I hope this not to warm up much when amplifying headphones, but as I included rear outputs for speakers, the heat sink may be necessary sometime.



The big white cord hides the shielding for the potentiometer wires, which was completely mandatory, to remove almost all the hum.



And this is the final product. Note the volume knob with rubber!





Some fancy LEDs with polarized paper makes it cool.