I am trying to set the custom border color of UIView programmatically in Swift.
vendredi 15 juillet 2016
Unexpected HTTP status code: 403 (-1) XCode 7
I have this error when I push my code to github repository by XCODE 7
Can/Should i inherit from STL iterator?
Can/Should i inherit from STL iterator to implement my own iterator class? If no, why not?
Firebase and Auth0 integration with Instagram for mobile
jeudi 14 juillet 2016
What's a good website to learn programming languages [on hold]
What's a good place to learn all programming languages such as objective C++. This includes YouTube videos and websites. Thanks in advance.
How to Integrate facebook Login in app
I have 1 button.
I want make this button connect to Facebook and show profile, picture, name.
How to do that with objective c.
How to stop running the app when you double tap the home button or go to the home page?
1000 simultaneously user login in iPhone application
Covert %E2%80%A2 to string in ios?
NSString *encodedString = @"For Rent %E2%80%A2 Ware House %E2%80%A2 200 Sq.Ft %E2%80%A2 200 Sq.Ft";
%E2%80%A2 is actually a bullet sign. How to convert it?
Auto Layout(Constraints) Vs Auto resizing mask(Springs & Struts)
These help you for resizing regardless screen size and Orientation. Question is , if you have Auto resizing mask(Springs & Struts) like easy solution, why should i use Auto Layout(Constraints) ?
Can Voro++ be compiled in Visual Studio
I need to make Voronoi 3D diagram and I have chosen Voro++ to make this with Qt.
Can I compile voro++ in VS or should I use another library?
how to use websokets in phonegap application for notify user?
I need to write phonegap(ios and android) app that in background listen websockets connection and notify user. Is any plugin for that, exist? Or any other way to do it ?
how to set the distance between left view and right view in the carousel
Is there any way to change the distance between the left and the right view in carousel .
I've tried with setting the perspective but it makes my view small.
what does Error “Thread 1:EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0)” mean?
I got a error here when I try to build in the simulator
dyld_sim`dyld_fatal_error:
0x101799000 <+0>: int3
-> 0x101799001 <+1>: nop
Arc4Random in Swift?
I am looking to use the arc4random function in swift code, what would be the equivalent to this line of Objective-C code?
if (arc4random() % 2 == 0) {
// Swing 1
}else{
// Swing 2
}
How can I calculate count in set
How can I designate count of numbers in set? I mean, i have something like this:
1 5 19 25 38 87
and I want to designate count from 25 to 87
in this case it's 3
Is it possible to see how JavaScript's core is written?
Has Chrome, Firefox or any browser released their source code?
Basically, I was wondering how the JSON
package was written.
Golang for instance has made their code open-source.
What does it mean to inherit from lambda?
Found this code which looks to be interesting:
auto a = [](){};
class B : decltype(a)
{
};
I want to know what it does. Can this be useful in any way?
Advantage of winelib?
iOS Drawing PDFs with UIGraphics: how to set document title?
is it possible to create a generic closure in Swift?
c++ - walking on Set (from STL)
I was wondering if walking on Set (from STL) is very costly? I need sorted array and that's the only reason I used Set. Should I create my own sorted list or walking on Set is "ok"?
Is there anyway to generate coverage reports on sonar?
How do I know which is the default measure system (imperial or metric) on iOS ?
How do I know which is the default measure system (imperial or metric) on iOS ?
How do I get this preference from the device settings, so I know what to display in my app ?
thanks
Add navigation bar to a view controller without a navigation controller
boost::gregorian::date with time?
So far it looks like boost::gregorian::date
only has day/month/year. I need to also store hour/minute/second. Can this object handle both? I'm having difficulty understanding how to represent all of this data.
Embed compiled inline assembly back into C++
Interactive push notifications - Hide/Show buttons
mercredi 13 juillet 2016
Parse check new item created in background
I have a IOS Objective c app that I need to preform a action once a new object is created in Parse. Is there some way I can wake the app by making it query by the user who created the object.
What is the difference between #include <filename> and #include "filename"?
In the C and C++ programming languages, what is the difference between using angle brackets and using quotes in an include
statement, as follows?
#include <filename>
#include "filename"
How to override the context-sensitive help button click?
I want to show the message box after clicking the context-sensitive help buttons.
What windows message I need to override?
Thank you!
clrscr(); equivalent in Code::Blocks
how to clear the output console in code blocks?? why doesn't clrscr(); work in Code::Blocks but works in Borland??
I have already tried:
cout << "x1b[2Jx1b[1;1H" << flush;
cls() ;
how to obtain ipmi fru raw data?
Is there API for obtaining ipmi fru raw bytes? I need to work with custom FRU data. I've tried to use freeipmi library - but it seems it has only API to access custom fields and does not expose API to read whole fru buffer.
Accessing struct member through unique_ptr gives segmentation fault
This is how I set pointer to struct. At runtime segmentation fault is thrown at second line. LoadedPDFInfo is struct in Canvas namespace
struct std::unique_ptr<Canvas::LoadedPDFInfo> pdfInfo;
pdfInfo->handle = ++currentPDFHandle;
pdfInfo->totalPageNum = FPDF_GetPageCount(doc);
How to change Status Bar text color in iOS 7
My application has a dark background, but in iOS 7 the status bar became transparent. So I can't see anything there, only the green battery indicator in the corner. How can I change the status bar text color to white like it is on the home screen?
Does binding a reference actually evaluate the operand?
Consider this code:
int& x=*new int;
Does RHS of the assignment actually dereference the newly-created pointer, leading to UB due to reading uninitialized variable? Or can this be legitimately used to later assign a value like x=5;
?
Instagram api error bad request ios
Hi I am having an issue with Instagram while performing authentication process. It was working fine few weeks ago, nothing changed in the code.
The issue now facing is that after a login process of Instagram, safari display an error "Bad request 400" and nothing more then that.
How should I make UIWebVeiw support https cache to disk?
I use NSURLCache cache. When using UIWebView http request can be correctly cached data to disk, but https can not be cached to disk I use https WKWebView make the same request, it can be successful cache to disk. How should I make UIWebVeiw support https cache to disk?
A Base Class pointer can point to a derived class object. Why is the vice-versa not true?
When to use template vs inheritance
What does #ifdef 1 in C++
in C++, I know that programmers use #ifdef 0
to block out code from running, but in this same project I see a lot of #ifdef 1
. Does this mean that the code always runs? Unfortunately the code does not compile so I can't just run and test!
How to expand the hitTest area of a UIButton without extruding it's background image?
I have set the UIButton
's background image and put a title on it(I used setBackgroundImage
method not setImage
). Now I want to expand the hitTest area of a UIButton
without extrude it's background image.
How can I do this?
Is it possible to transfer control of a program between GDB sessions?
AI Algorithms - Closed Lists
click the print button in chrome browser using c++
How do I click the button in the print setting of Chrome using C++ or how do I print in PHP code without showing the print setting of Chrome?
With that I can call a PHP file which will automatically print the page without showing the print setting of Chrome.
Why is priority of round brackets ignored
C++ Hello World does not work
What is the .Z for acceleration on an iPhone?
I am using Core Motion on my app. I know that the .X is moving the iPhone along the long axis and the .Y is moving the iPhone across the short axis. But I do not know what the .Z is reading, so if anyone could explain that to me it would be great.
If I was creating a mashup of Instagram and Behance, what will I need to know?
The information I think I need:
- All software I'll need.
- All hardware I'll need.
- All coding languages I'll need to know.
- Other skills that I'll need.
Please add anything in addition to these points of information if you think it is relevant.
How to make sure draw operations are pixel aligned on Mac?
In recent iOS techtalk, I heard a suggestion about "make sure your draw operations are pixel aligned".
Is this a valid suggestion for Mac/iOS drawing performance?
Another question is how I can determine my code is drawing with pixel aligned?
Is there any tools or tricks can help?
How to update MPNowPlayingInfoCenter in Swift?
In objective c, I've been using code like this to update MPNowPlayingInfoCenter:
[[MPNowPlayingInfoCenter defaultCenter] setNowPlayingInfo:
@{ MPMediaItemPropertyArtist : @"Artist!",
MPMediaItemPropertyTitle : @"Title! }];
But in Swift, it doesn't seem like the function "setNowPlayingInfo" is recognized:
MPNowPlayingInfoCenter.defaultCenter().... // Can't identify 'setNowPlayingInfo()'
Is there anything I'm missing?
convert the string to specific datetime format with strptime in c++
I have a string in format Date Time 20160524T154628
Now want the values in terms::hr :: 15,mm:: 46,ss :: 28,month:: 05,year:: 2016,day:: 24
string convertstring(*str1)
{
struct tm t;
strptime(sr1, "%Y%m%dT%H%M%S", &t);
char buffer[256];
strftime(buffer, sizeof(buffer), "%F %T", &t);
string str2(buffer);
return str2;
}
mardi 12 juillet 2016
After resetting iPad, will setting it as new update the iOS?
I have an iPad Air 2 running iOS 8.1, I wanted to reset it without updating it, so I ran the "Erase Contents and Settings" option. Now it is giving me the option to set the iPad as new, will this update the iOS to the latest version or keep it in 8.1?
Thank you!
How to get UIImage from local url and post the image to server ?
Why is the picture changed by opencv is unclear in iOS program?
I use the opencv in iOS:
UIImage* original_Img = [UIImage imageNamed:IMG_NAME];
UIImageToMat(original_Img, _cvImage, true);
UIImage* rImage = MatToUIImage(_cvImage);
[self.personView setImage:rImage];
why is the picture unclear?
convert wrf output from NetCDF format to text file
Dear all i have a numerical weather model called WRF and have an output file from it like wrfout_2014-12-16_06 in netcdf format containing many variables i want to extract some variables from that file into text file so i can plot that variable values on a map using NCL scripts . thanks in advance
When my textfield is empty, my app crashes how do I respond to an empty text field?
How do I know if std::map insert succeeded or failed?
I have a map in a multithreaded app mapping a class called uuid to pointer. What I want to know if an insert operation succeeded for failed.
e.g.
_mymap.insert(hint, MyMap::value_type(entry.uuid, itemptr));
Does it throw an exception or something if it fails?
What is the equivalent for gotoxy() in code:: blocks (MinGw)?
I've gotoxy in Borland's turbo C++ a lot in the college but I can't use it in the modern IDEs. I know it is a function of conio.h library file. It is very important for me to know this. Tell me how to use it OR what is its equivalent function in the modern compilers?
virtual function call from base class
How can I solve the sparse linear system with the coefficients in Z_2?
Adding a music file to an C++ console application
Is it possible? If it is ... I want a way to add and play a music file(like .mp3 or .wav) in the background of the console application while it runs.My operating system is Linux Ubuntu 11.10 32 bit and my ide is code::blocks.And could you give me an example?(I mean an example code)
C++ illegal digit, simple issue
I'm running against this error:
int temp = 0789;
error C2041: illegal digit '8' for base '8'
For what I can understand is that the compiler understands any number that begins with 0 like 0123 to be octal. But how can I tell the compiler to just take it with the 0 in front?
What's wrong with my macro function?
I defined a multi-line macro function using line continuation character "" like the following:
#define SHOWMSG( msg )
{
std::ostringstream os;
os << msg;
throw CMyException( os.str(), __LINE__, __FILE__ );
}
But it could not pass compilation. BTW, I'm using VS2008 compiler. Would you please tell what's wrong with my aforesaid macro function?
How to connect to local Parse Server from the Parse iOS SDK?
Is there a way to use iOS/Siri voice to text capabilities to add a voice interface into an app?
For example, I would like to build an app to remind me to pick up a kid from daycare. I'd like to touch a button inside the app and dictate instructions that "Daycare closes at 3pm tomorrow" and I can then process the text rather than making them select from pulldowns. Is this possible in some iOS kit?
Build OpenSSL in Visual Studio 2013
Getting the following error: This application is modifying the autolayout engine from a background thread
I get this warning with this code. I am checking in the background if an update is available. And then present an alert. Obviously Xcode and iOS don't like my thinking... any ideas?
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), {
if CheckAppUpdate().appUpdateAvailable("http://itunes.apple.com/lookup?id=xxxxxxxxxxxxx") == true {
self.showAlertForUpdate()
}
})
Can i create a pen pressure sensitivity? IN PC (In any program available) [on hold]
I want to create a pen pressure data in window. Can i create a pen pressure sensitivity?
As for adjusting the pressure using the speed.(In photoshop, sai-tool, etc)
I am not good at English. sorry :(
(Is there any way to using Java? jTablet is only just sense , it can't be create a pressure.)
Is for (auto& a : a) grammarly right?
For example, I defined an multidimensional array
array<array<array<int, 3>, 4, 5> a;
And I loop it
for (auto& a : a)
for (auto& a : a)
for (auto& a : a)
a = 1;
Is that right in grammar? I tested in VS2015. No compilation errors.
Allowing longer usernames in JSQMessagesViewController
Is there a way to check to see which achievements have been unlocked in unity?
So i'm updating my android and ios application using the unity game engine. I want to add unlockables based on which achievements the user has unlocked. I have about 20 or so achievements. I can't find anywhere a method to check to see if a particular achievement has been unlocked or not. Im using Gamecenter for ios and Google Play Games for android.
How do I configure the text field to account for the expiry date?
I am entering credit card information and I want the expiry date to be a max of 5 characters 4 numbers and a "/" automatically enters after the first two characters i.e. 01/17 after typing 01 the / is automatically entered, and allows only two more characters "17".
func textField(textField: UITextField, shouldChangeCharactersInRange range: NSRange, replacementString string: String) -> Bool
{
if textField == expire{
}
return true
}
Simultaneous outgoing call to user using twilio in iOS Application
I'ld like to make native call to user until user answer the call (Recursive call). If in case of voice mail than also doing same. Is it possible using Twilio
in my iOS application.
Also i want to know whether call is answered by human or machine.
If yes than please suggest me some solution. Thanks in advance.
libusb + librealsense in Xcode
I have installed libusb with homebrew and when i run librealsense examples in Xcode 7.3.1-- I get the following error: dyld: Library not loaded: /usr/local/lib/libusb-1.0.0.dylib Referenced from: /Users/geraldine/Library/Developer/Xcode/DerivedData/librealsense-fadnmciffrdzahccafnhrymkzrmd/Build/Products/Debug/c-tutorial-1-depth Reason: Incompatible library version: c-tutorial-1-depth requires version 2.0.0 or later, but libusb-1.0.0.dylib provides version 1.0.0 (lldb) Any suggestions appreciated!
How to use Unicode range in C++ regex
I have to use unicode range in a regex in C++. Basically what I need is to have a regex to accept all valid unicode characters..I just tried with the test expression and facing some issues with it.
std::regex reg("^[\u0080-\uDB7Fa-z0-9!#$%&'*+/=?^_`{|}~-]+$");
Is the issue is with \u
?
lundi 11 juillet 2016
How to configure FFmpeg library with ndk r12 using windows 7 64 bit operating system for android
I want to merge mp3 audio file with surfaceview recorded video in background. So after lots of research i get FFmpeg concept for achieving this kind of functionality. But i am not know how to configure Ffmpeg library with ndk in android studio using windows 7 64 bit os. So if any one can have knowledge about it so please share with me. Thank you in advance.
Load UISplitViewController from UITableView
how to create integratable module for mobile apps
Let's say I want to build a mobile App which others can include/integrate in their app as a separtate module. The goal is that the customers can add the functinality of my app into theirs. Since the customers have different OS/plattforms it should be plattform independent. Could i write a html5 hybrid app which is then integratable through a plugin into every existing app?
Templated function not called
I have overloaded a function in my string class, however, it never gets called. Why?
template <class T>
class StringT {
public:
void assign(const T* ptr);
template <size_t N> void assign(const T(&ptr)[N]);
};
int main() {
StringT<char> str;
str.assign("Hello World"); //calls "void assign(const T* ptr)" although type is (const char[12])
}
OK 'collectionView:didEndDisplayingCell:forItemAtIndexPath:' is called when the cell is deleted
I just noticed that now. Collection's collectionView:didEndDisplayingCell:forItemAtIndexPath:
is called when the cell goes out of scope and also when the cell is deleted and is about to go away forever.
Is there a way to know, from inside that method if a cell is just invisible or is being deleted without having to track the cell by other means?
UIButton: Making the hit area larger than the default hit area
I have a question dealing with UIButton and its hit area. I am using the Info Dark button in interface builder, but I am finding that the hit area is not large enough for some people's fingers.
Is there a way to increase the hit area of a button either programmatically or in Interface Builder without changing the size of the InfoButton graphic?
Missing return in a function
It's a simple question. As you can see in the code, there is return in every case. But , somehow, xcode does not recognizes the return in the refresh()
's completionHandler
block.
Any suggestions?
func accessTokenWithBearer() -> String {
if !didTokenExpire() {
return "Bearer (accessToken!)"
}else{
Token.refresh({
return "Bearer (self.accessToken!)"
})
}
}
class func refresh(completion: ()->()){
completion()
}
Upload dsym manually to Firebase
When I try to use the batch-upload script it can't find the UUID:
./Pods/FirebaseCrash/batch-upload 4FDFDF95-52E5-33FE-87C5-XXXXXXXXXXXX
4FDFDF95-52E5-33FE-87C5-XXXXXXXXXXXX: warning: no executable or bundle
However, I am able to download the dsym with the correct UUID from iTunes Connect (Apps -> Activity). How can I upload this file to Firebase?
How to change the state of an UIButton in iOS using Swift?
I have Objective-C working code for six buttons but I don't seem to find how to change the state of a button using Swift. So how do I make the following code work in Swift?
[self.button2 setBackgroundImage:[UIImage imageNamed:@"button2_selected.png"] forState: UIControlStateSelected];
button1.selected = NO;
button2.selected = !button2.selected;
button3.selected = NO;
button4.selected = NO;
button5.selected = NO;
button6.selected = NO;
Full path to file [QT]
I make a video player and i need a full path to file that i'll open through QFileDialog. How to do it? Is there any functions for this in Qt? My present algorithm gives me only name of the file, not a full path. My code for now:
void videoWindow::handleFile()
{
*filename = QFileDialog::getOpenFileName();
if (*filename != "D:\фото\video\P1150278.MOV" | *filename != "")
{
video_enable(videoWid, *filename);
}
}
How to detect if a textfield is empty in swift?
Sinch send a message to all online clients
I want to send a message to everyone who online on Sinch at the moment, so I guess that I need to get list of connected clients, where can I get that?
I have already thought about insert new connected client to database or put into a file on my server , and remove this when disconnect but I think is not the best way.
Any idea?
How do I write dispatch_after GCD in Swift 3?
In Swift 2, I was able to use dispatch_after
to delay an action:
var dispatchTime: dispatch_time_t = dispatch_time(DISPATCH_TIME_NOW, Int64(0.1 * Double(NSEC_PER_SEC)))
dispatch_after(dispatchTime, dispatch_get_main_queue(), {
// your function here
})
But this no longer seems to compile in Swift 3. What is the preferred way to write this in Swift 3 (using the new Dispatch API)?
Saving an Array in Array with NSUserDefaults in Swift [duplicate]
This question already has an answer here:
I'm using Swift to make a notes app. I have an array like this:
var Theme = [(Title: String() , Notes: [String]())]
and would like to store it with NSUserDefaults. Thanks.
C++ What is the easiest library to crypt any file? [on hold]
I do a research about ransomware and want to create a simple software to test our local protection software, which recognize file modifications. I want to encrypt and decrypt all files in windows documents and pictures.
I am looking for a library, which is easy to use and applicable in Visual Studio 2010. Maybe there is already an existing project, which I can reuse.
Thanks for your support.
Cordova plugin - reference file from www folder
I have a .js file that is relevant to my cordova app www folder, as well as a plugin that I am creating for iOS. From the native iOS code in the plugin folder, how can I reference my .js file without duplicating it?
From my Android src code I found a way to refer to this file which seems somewhat hacky: file:///android_asset/www/app/drivers/myApi.js
I'm not able to access developer.apple.com with my apple id
how to prevent renamed Xcode project from replacing icon on iPhone springboard
Xcode 7.3
My app is installed on my demo iPhone4. I want to quickly create a modified version of my app on the iPhone4, but want to keep the original app also. I changed project name. However, when I run it, it replaced the original icon, shown in springboard, with same icon, as expected, and with new project name.
How can I have both the original app and the new app?
Interpreting a method with three return types in C++
I found several lines of code in this header FTD2XX that seem to have function signatures with three return types. How do I interpret this? Here is an example
FTD2XX_API
FT_STATUS WINAPI FT_Read(
FT_HANDLE ftHandle,
LPVOID lpBuffer,
DWORD nBufferSize,
LPDWORD lpBytesReturned
);
All help is much appreciated.
Android Constraint Layout
Hey Folks I am a Rookie developer.I tried Relative layout when i was working with android.Recently I watched Google i/o video on Constraint layout.
Why constraint layout since there is relative layout
Now I'm working full time as a IOS developer is Constraint layout and Auto layout ios same thing?. This question have been in my head since Google IO.
Can somebody clear it out.
java to C++ P2P connection
I am looking for a library that can help implement P2P connection between some sort of peers (written in java and C++), the library should also solve NAT traversal problem. I just need to have an ability to lookup peers and establish a pure socket connection.
The P2P network may be centralized or hybrid. It does not make sense.
Is there any open source such a library?
Thank you.
OpenCV Create VHS distortion
How can I use OpenCV to create a VHS-like distortion? Similar to what is found on this youtube video.
How is a Swift CGVector created with dx and dy (derivative)?
I'm trying to understand how a Vector is created in Swift, because when I do CGVectorMake(), tells me to pass a dx and dy (derivative) as a CGFloat. How can I create a Vector (line) with only that information?
Can anyone explain me ? Like for dummies? I searched in Google but I still couldn't find an easy explanation.
Let's say I would like to create a Vector that goes from point (0,0) to point (5,5).
when i'm dong ( AFNetworking 3.1) web request,how can i analyze failure task
[manager POST:url parameters:params progress:nil success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) { success(task, responseObject);
} failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
NSHTTPURLResponse* httpResponse = (NSHTTPURLResponse*)task.response;
NSInteger responseStatusCode = [httpResponse statusCode];
NSString *responseText=task.response.description;
// NSString *responseText = operation.responseString;
NSData* data=[responseText dataUsingEncoding:NSUTF8StringEncoding];
NSDictionary *dict = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableContainers error:nil];
failure(dict ,responseStatusCode);
}];
My server come back failuer code,how can i get it?
dimanche 10 juillet 2016
Unrecognized Font Family on React Native
I'm running into a peculiar error using React Native. Inside my button.js
I am doing
import Icon from "react-native-vector-icons/MaterialIcons";
const icon = (Icon name="menu size={20} color="green"/>);
render()
return(
{icon}
)
But I'm given the error
Unrecognized Font Family 'Material Icons'
However when I import FontAwesome as:
import Icon from "react-native-vector-icons/FontAwesome";
I get no error.
Obtain the total number of samples with FFMpeg
Currently my application reads audio files based on a while-realloc loop:
// Pseudocode
float data* = nullptr;
int size = 0;
AVFrame* frame;
while(readFrame(formatContext, frame))
{
data = realloc(data, size + frame.nSamples);
size += frame.nSamples;
/* Read frame samples into data */
}
Is there a way to obtain the total number of samples in a stream at the beginning? I want to be able to create the array with new[]
instead of malloc
.
Iterate For Loop Overtime in Swift
How can I iterate a for loop overtime in swift? A typical loop will execute immediately as fast as possible. However, I would like to expand the time in which the loop occurs. Say I have the following loop:
for var i = 0; i < 4; i+=1{
print(i)
}
And I wanted this loop to occur over a span of 1 second, each iteration taking 0.25 seconds. How could I do this? Thanks for any help
Swift dynamic view based on cell tapped in previous table view
I have a table view with a list of events. I now am trying to create a dynamic view that can show details about all of those events based on the event tapped on. Two questions I have are how do I create a generic segue that I can use for any table cell to go to the same view, and then in that view how do I access the cell that brought the user to the view?
Use placement new to create a static const pointer to a static memory buffer
I'd like to initialize a static, constant pointer to an object of class type MyClass2, which is stored in a static data buffer in class MyClass1 when it is instantiated.
This doesn't work:
class MyClass1 {
public:
MyClass1()
{
_my_class_2_ptr = new (_my_class_2_buf) MyClass2();
}
private:
static MyClass2 *const _my_class_2_ptr;
static char *_my_class_2_buf = new char[sizeof(MyClass2)];
};
Is there a way to accomplish something like this?
3D touch shortcut breakpoint
Here's my code for a 3D touch shortcut. When I tested on iPhone 6s, the app will crash when I 3D touch and tap the shortcut.
func application(application: UIApplication, performActionForShortcutItem shortcutItem: UIApplicationShortcutItem, completionHandler: (Bool) -> Void) {
if shortcutItem.type == "com.loafer.start"{
let sb = UIStoryboard(name: "Main", bundle: nil)
let quickAction = sb.instantiateViewControllerWithIdentifier("ConfigureViewController") as! UINavigationController
window?.rootViewController?.presentViewController(quickAction, animated: true, completion: nil)
Breakpoint
}
How to prevent size_t from being interpreted as reference?
How can I change the signature of distanceTo(..)
to make the compiler warn or error on a call with std::size_t
as parameter?
class Point {
private:
float value;
public:
Point(float value) : value(value){};
float distanceTo(const Point &point) { return point.value - value; }
};
int main() {
std::size_t index = 1;
Point start(1);
Point end(4);
float dist = start.distanceTo(index); // compiles, but should not!
std::cout << dist;
return 0;
}
How do I animate a property that my framework and libraries don't support animating
Why wstring can accept WCHAR[] while string doesn't accept UCHAR[]
I am trying to print the returned value of NtQueryKey
which is UCHAR Data[1];
i have tried printf
, cout
, and string(Data, DataLengh)
, with the first two printing only 1 character and the last one throws an exception... Basically if i changed the Data Type to WCHAR Data[1]
and used wstring(Data)
it accepts it normally without any complain... also wprintf
prints the value normally.
Recalculate value as UIStackView animation proceeds
Where are the Serial functions in Arduino defined?
How do I get started writing my own IP-Like Protocol?
So my question is, would it be possible to write a protocol which does the same as the Internet Protocol, and if so, how do I get started? And don't say, "isn't the Internet Protocol good enough?", yes it is, it is just to see if it is possible:P
I would like to know a bit more about how, just for learning how protocols are done. I have some experience in programming, but not anything like networking protocols.
iOS tableView not showing full table
Use value entered in UITextField [duplicate]
This question already has an answer here:
How can I take an input value from the user with a text field and then use it to perform math functions in Swift?
I want to get a value from the user and then find the sine of that value.
How can I change my value with Firebase
My code give me an infinite loop he never go in if or else, I'm pretty sure that because firebase get only asynchronous function.
I want to check if "random_hexa" exist, and get new random until I get a value who don't exist on my database
while (bool_check_while_exist == false)
{
ref.child("Salons").child(random_hexa).observeSingleEventOfType(.Value, withBlock: { (snapshot) in
if (snapshot.exists())
{
random_hexa = self.randomAlphaNumericString(5)
}
else
{
bool_check_while_exist = true
}
})
GetVersionEx deprecation - how to get product type (VER_NT_DOMAIN_CONTROLLER) from newer API's
Swift - Fatal Error on Performing Segue
Objective-C: UILocalNotification
iOS 7 contact number spaces are not spaces
How to segue to a specific view controller inside a tab bar controller with losing the tab bar?
Check if an URL has got http:// prefix
In my application, when the user add an object, can also add a link for this object and then the link can be opened in a webView.
I tried to save a link without http:// prefix, then open it in the webView but that can't open it!
Before webView starts loading, is there a method to check if the URL saved has got http:// prefix? And if it hasn't got it, how can I add the prefix to the URL?
Thanks!
How do I store serialize an NSDictionary with NSJSONSerialization when one of the values is NSData?
Take this simplified example:
let dict: [String: AnyObject] = ["foo": ("bar" as NSString).dataUsingEncoding(NSUTF8StringEncoding)!9]
let json = try! NSJSONSerialization.dataWithJSONObject(dict, options: [])
I cannot get that to run, it crashes with:
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Invalid type in JSON write (NSConcreteMutableData)'
I need to send a block of JSON to my server, where some values are strings and some are NSData
. What am I doing wrong?
Is it possible a signal handler interrupts another singal handler for the same signal?
C++ documentation states that:
"If a signal handler is executed as a result of a call to the
raise
function, then the execution of the handler is sequenced after the invocation of the raise function and before its return. [ Note: When a signal is received for another reason, the execution of the signal handler is usually unsequenced with respect to the rest of the program. —end note ]"
Does this means that a handler could interrupt another handler?
Converting AnyObject to String ios Swift
samedi 9 juillet 2016
Recommended open source voice matching library on iOS? [on hold]
I need to achieve the following scenario on iOS and Android:
For word "hello", the user speaks "hello", the phone recognises it, and tells how well it matches it.
I performed research online and understood that this was a Shazam-scenario and there were articles that explained how it works e.g. creating Fast Fourier Transformation and hashes. What I'm looking for here is some mature working library that you would recommend and people usually use today.
Any guidance will be appreciated.
Set the browser to be used to open URLs in iOS App Webview
C++ return a class object by reference
I have a class called Object which stores some data.
I would like to return it by reference using a function like this:
Object& return_Object();
Then, in my code, I would call it like this:
Object myObject = return_Object();
I have written code like this and it compiles. However, when I run the code, I consistently get a seg fault. What is the proper way to return a class object by reference?
iOS Swift2.2 testing reachable on host IP
So I'm still trying to check if a host is reachable. All solutions i've found so far just check if there is a network connection but not if a certain host is available..
Tried a lot of different things, thats where I am at the moment:
private static func networkAvailable1() {
let networkStateHost: Reachability.NetworkStatus
do{
let hostReachability = try Reachability.init(hostname:"apple.com").currentReachabilityStatus
print(hostReachability)
let hostReachability1 = try Reachability.init(hostname:"localhost:8080").currentReachabilityStatus
print(hostReachability1)
}
catch {
print("Unable to create Reachability")
}
creating an array of object pointers C++
I want to create an array that holds pointers to many object, but I don't know in advance the number of objects I'll hold, which means that I need to dynamically allocate memory for the array. I have thought of the next code:
ants = new *Ant[num_ants];
for (i=1;i<num_ants+1;i++)
{
ants[i-1] = new Ant();
}
where ants
is defined as Ant **ants;
and Ant
is a class.
Will it work?
UILocalizedIndexedCollation: What is the difference between .sectionTitles and .sectionIndexTitles?
Straight forward question: UIKit's UILocalizedIndexedCollation contains two similar properties, sectionTitles
and sectionIndexTitles
, that both return type [String]
.
In US English, both properties return [A, B, ... Y, Z, #]
. What the heck is the difference between the two? Surely, there must be a reason for having two properties. The documentation isn't very clear, so an "explain like I'm 5" answer would be great.
UILocalizedIndexCollation: What is the difference between .sectionTitles and .sectionIndexTitles?
Straight forward question: UIKit's UILocalizedIndexCollation contains two similar properties, sectionTitles
and sectionIndexTitles
, that both return type [String]
.
In US English, both properties return [A, B, ... Y, Z, #]
. What the heck is the difference between the two? Surely, there must be a reason for having two properties. The documentation isn't very clear, so an "explain like I'm 5" answer would be great.
Custom UIViewController subclass only shows a black screen
I have created a subclass of UIViewController called LoginController. I have a LoginController.xib file that contains a view controller with a few elements in it. I have set the class of the view controller to LoginController and I have set my Main Interface to LoginController. Upon launching my app, I see my splash screen, followed by a pure black screen. My LoginController class just has the default code like so
class LoginController: UIViewController
{
override func viewDidLoad()
{
super.viewDidLoad()
}
override func didReceiveMemoryWarning()
{
super.didReceiveMemoryWarning()
}
}
iOS iPhone app not displaying correctly on some devices
So I've been working on a PDF reader for iOS, the app itself works fine on iPhone 6 and I think 5 as well, however on iPhone 4S and when running in compatibility mode on iPad it only displays this:
I cannot submit my app to the iTunes store without fixing this issue, does anybody know what is causing it?
The app is coded in Objective C
IOS Jailbreak How do intercept SMS / Text Messages
I'm currently trying to write an application that intercepts text messages and reacts depending on the content of that message.
I tried to hook into _receivedMessage:(struct __CKSMSRecord *)message replace:(BOOL)replace
method in the CKSMSService class but this seems not do get called at all.
Could someone please tell me what function/class i have to hook in? I need to intercept the text message before it gets displayed and stored into the database. I'm on IOS 5.0.1.
Any help is truly appreciated.
why instrument 7.3.1 cannot capture texture allocation on iphone6(9.3.2)? but It works for iphone5c(9.3.2)
I mark two generations for both iphone5c and iphone6 in the same game stage.
The 1st image tell us generation B allocate 163.55MB including 92.46MB textures.
However, on 2nd image only capture 79.65MB, all allocations are almost the same except GFX Texture Level.
Is there anyone can tell me why?
What happens in the case of nearest neighbour interpolation OpenGL centre of pixels
What happens when a nearest neighbour interpolation occurs where the pixel for which the nearest neighbour interpolation is being calculated in texture is at the same distance from two neighbouring pixels, and the pixel falls equal distance in length from the two pixels that it is trying to correctly interpolate for a new pixel in the case of magnification.
Does OpenGL take the two pixels and interpolate a colour from the texture by taking an average value from the two at same length distance or something else happens?
Linear solution for 2^x *3^y*5^z
CMPedometer watchkit vs iOS app
When I query the number of steps using CMPedometer, iOS app returns different value than watchkit. iOS app returns step counts captured by the device (iPhone) and watchkit by the watch as predicted.
How do I get the number of steps recorded by a phone on watchkit without using Healthkit or an app running on iPhone.
I downloaded an app, "Steps Pedometer & Step Counter Activity Tracker", and this app does do exactly what I was looking for. I am wondering how they are doing it.
iOS background wake on password protected device
UIControlState.Normal is Unavailable
Previously for UIButton
instances, you were able to pass in UIControlState.Normal
for setTitle
or setImage
. .Normal
is no longer available, what should I use instead?
let btn = UIButton(frame: CGRect(x: 0, y: 0, width: 20, height: 20))
btn.setTitle("title", for: .Normal) // does not compile
(This is a canonical Q&A pair to prevent the flood of duplicate questions related to this UIButton
and UIControl
changes with iOS 10 and Swift 3)
iOS 9: How to change volume programmatically without showing system sound bar popup?
StartApp -> No such module 'StartApp'
Using StartApp in a Swift app I have this issue (Xcode 7.3.1). On the line:
import StartApp
I keep getting this error message:
No such module 'StartApp'
I have my StartApp.bundle and StartApp.framework set, and the Framework Search Paths are also set.
I already used StartApp in an Objectiv-C app before and I did have this problem.
Any idea to solve this issue would be welcome.
Audio file not playing from document directory
i have an audio file located in Document Directory and its not playing but I didn't get any error or crash. I'm really stuck at this situation, referred many SO links but none of them solved my issue.
var myPlayer = AVAudioPlayer()
let fileManager = NSFileManager.defaultManager()
let urls = fileManager.URLsForDirectory(.DocumentDirectory, inDomains: .UserDomainMask)
if let documentDirectoryURL: NSURL = urls.first {
let soundURL = documentDirectoryURL.URLByAppendingPathComponent("09.mp3")
do {
myPlayer = try AVAudioPlayer(contentsOfURL: soundURL)
myPlayer.delegate = self
myPlayer.prepareToPlay()
myPlayer.play()
} catch let error as NSError {
NSLog("Unresolved error (error.debugDescription)")
// SHOW ALERT OR SOMETHING
}
}
my thread in zygote process block start up of all other apps on my android phone
I can inject the android system process "zygote", and I can execute my code in it. It is all fine util I do this:
pthread_t id;
int ret = pthread_create(&id, 0, thread_main, 0);
static void* thread_main(void* param){
int count = 0;
while (count < 10)
{
count += 1;
usleep(1000 * 1000);
printf("wait in loop %d.", count);
}
return 0;
}
Then, startup of any app on my phone is blocked when the loop is running. It is so strange for an c++ developer! It is running in a thread, but it blocks others!
Swift segue to xib file programatically
I cant seem to figure this out. I am new to swift. i need to load a xib file from a navigation bar button item. I have to do this outside the storyboard because the same button item changes depending if the user is logged in or not. It reads "Login/Register" if a user is not logged in and goes to a login xib file and if a user is logged in it reads "Add Story" and goes to a add story xib file. Thank you for your time I really appreciate it.
Check if UIImage property got assigned or not?
I have an UIImage
property, and after shooting image from iPhone camera I assigned image object to this property, otherwise not.
How can I check if this property contains image after shooting or not?
Below my code didn't help.
@interface MyViewController : UIView<UINavigationControllerDelegate, UIImagePickerControllerDelegate>
@property(nonatomic, retain) UIImage *imageShot;
@end
@implementation MyViewController
@synthesize imageShot = _imageShot;
- (id)init {
self = [super init];
if (self) {
_imageShot = [[UiImage alloc] init];
}
}
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
self.imageShot = [info objectForKey:UIImagePickerControllerEditedImage];
}
- (void)buttonClick {
if (_imageShot) {
}
else {
}
}
@end
How do I use the Boost libraries in a qmake project?
Some days ago I compiled Boost ver. 1.53.0 for VS2012. It works fine, compiles fine. Now I want to use Boost with Qt Creator. In the .pro
file I've included
INCLUDEPATH += C:boostboost_1_53_0 -lboost_filesystem
LIBS += C:/boost/boost_1_53_0/stage/lib/
But when I compile I get 2 errors:
:-1: error: cannot find C:/boost/boost_1_53_0/stage/lib/: Permission denied
collect2.exe:-1: error: error: ld returned 1 exit status
What should I do? I've googled but seems I'm the first with this error.
Ads in iMessage Sticker App
Apple recently introduced sticker apps for iMessage and I was planning on making one. If I made an app I would like to monetize it. I'm wondering if it would be ok to put ads in an iMessage app or if Apple would reject the app because they wouldn't want ads in iMessage. Apple doesn't reference ads at all in its Human Interface Guidelines for iMessage apps. My alternative is a paid app but I'm reluctant to do that because it limits how many people would get my app. Would it be okay to use ads?
vendredi 8 juillet 2016
What C++ Library for constrained quadratic optimization is appropriate for implementing a state-space Model Predicitve Controller?
I'm used to Matlab's/Octave's quadprog, which is fast and accurate. However I still couldn't find an appropriate C++ library to do the same. I tried Ipopt but later then I discovered that it is issued for large-scale optimization problems, so it's not made for less-than-1-second timescales.
My benchmarks are the following ones:
- Sampling time of 0.1 seconds
- 30 up to 100 optimization variables (depends on the horizon)
- 10 to 25 constraints of the type u(1) + u(2) <= 120, so I'm not interested in box-constraints
Thanks!
Does default-initializing a non-const reference function parameter from a dynamically allocated dereferenced pointer create a memory leak?
I'm in front of this and will have to deal with C++98, possibly C++03, and C++11 :
type1 myfunc( type2& var = /*some value of type "type2"*/ )
{
// Some code
}
I tried this :
type1 myfunc( type2& var = *(new type2) )
{
// Some code
}
And of course it works, but I'm not sure wether this creates or not a memory leak. What does this code exacty do in the computer memory ? If I can't do this, do I have any other solutions than to overload my function?
Access violation when writing two dimensional vectors
My program keeps on crashing when x = 2
and y = 6
cellChargeTime[x][y].push_back(0);
Any ideas on how to fix this or what might be causing this crash.
vector<int> **cellChargeTime;
cellChargeTime = new vector<int>*[xMax]; //xMax = 40
for (int x=0; x<xMax; x++)
cellChargeTime[x] = new vector<int> [yMax]; //yMax = 40
for (int x=0; x<xMax; x++){
for (int y=0; y<yMax; y++){
for (int i=0; i< numRuns; i++){ //numRuns = 1
cellChargeTime[x][y].push_back(0); // Crashes at x = 2; y = 6
}
}
}
Dev C++ shows different errors while compiling
#include<iostream>
using namespace std;
int main()
{
cout << "Hello World!";
return 0;
}
The errors are:
Warning source file not compiled.
Compiler: Default compiler
Building Makefile: "F:OmMakefile.win"
Executing make...
mingw32-make.exe -f "F:OmMakefile.win" all
c++.exe C:/Dev-Cpp/Examples/mgt.o -o "Project2.exe" -L"C:/Dev-Cpp/lib"
c++.exe: Internal error: Aborted (program collect2)
Please submit a full bug report.
See <URL:http://www.mingw.org/bugs.shtml> for instructions.
mingw32-make.exe: *** [Project2.exe] Error 1
Execution terminated
Boolean evaluation in C++ [on hold]
how to use the popToViewController
Setting sound configuration for Socket device
Using the following code to attempt setting the sound on/off for a Socket 8ci...not quite working for me. Can you suggest a proper command? As you can see in the code I set the Sound frequency based on a preference boolean. Thanks!
DeviceInfo device = (DeviceInfo) _scanApiHelper.getDevicesList().lastElement();
short[] soundConfig = new short[3];
// default the sound to On
if(getBRSharedPreferenceBoolean(PreferencesActivity.PREF_SOCKET_SCANNER_BEEP, true)) {
soundConfig[0] = ISktScanProperty.values.soundFrequency.kSktScanSoundFrequencyHigh;
} else {
soundConfig[0] = ISktScanProperty.values.soundFrequency.kSktScanSoundFrequencyNone;
}
soundConfig[1] = 200;
soundConfig[2] = 100;
// set the scanner sound config
_scanApiHelper.postSetSoundConfigDevice(
device,
ISktScanProperty.values.soundActionType.kSktScanSoundActionTypeGoodScan,
soundConfig,
_onSetScanApiConfiguration);
iOS status bar white glitch
I have a presented view controller that has status bar hidden set to true. When I dismiss this view controller, a solid white view (the exact size of the status bar) briefly appears at the top of the view controller, and then the dismissal happens.
It's a quick little glitch, but I have no idea why it is occurring, I have plenty of similarly presented views that are not glitching up like this. I have not been able to find any distinctive factor that could be causing this
Have any of you had this issue?
how to simplify and make it better using enum, swift learning, enum
I am defining some of ranges by following
let range0_15 = 0 ..< 15
let range15_30 = 15 ..< 30
let range30_45 = 30 ..< 45
let range45_60 = 45 ..< 60
I really want to use Enum
for this by trying
enum range : Range<Int> {
range0_15 = 0 ..< 15
range15_30 = 15 ..< 30
range30_45 = 30 ..< 45
range45_60 = 45 ..< 60
}
And I am getting an error
Type 'CoreDataStach.range' does not comform to protocol RawRepresentable
Is it possible to define an enum like above and if it is yes, what I am missing right here.
Automate an iOS app (that's not mine)
There is an iOS graphics app that has graphics filter that simply doesn't exist in any other app, on iOS, Android, or desktop.
I want to use one of its filters in a script. But it seems that there is no way to automate an iOS app that I did not develop.
Desktop and Android are of course easy to automate.
Is there hack or workaround that will (with a lot of trouble) simply tap a button on this app when my script asks for it? ...That doesn't involve robotic finger?
uSTL or STLPort for Android?
I'm working with the Android NDK, and since it does not currently support the STL, I was wondering if there are any brilliant people out there who have had success with this, or know which is better suited for the Android platform: uSTL or STLPort.
EDIT: Looks like another option may be CrystaX .NET.
From their website:
...customized distribution of Android NDK r3 which I have rebuilt from official sources. Support of C++ exceptions, RTTI and Standard C++ Library added.
c++ DEVICE_OBJECT's FILE_PORTABLE_DEVICE Characteristics doesn't work on win7?
I want to pick the portable devices out,but the DEVICE_OBJECT's FILE_PORTABLE_DEVICE Characteristics doesn't work on win7 but win10, In win7,all devices's FILE_PORTABLE_DEVICE are 0x00. In https://msdn.microsoft.com/en-us/library/windows/hardware/ff543147(v=vs.85).aspx says:FILE_PORTABLE_DEVICE Indicates that the underlying stack considers the device portable. This is used by the storage stack and means that the device is not in the local machine container and is not on a fixed bus type.
Color Tint UIButton Image
I noticed that when I place a white or black UIImage
into a UISegmentedControl
it automatically color masks it to match the tint of the segmented control. I thought this was really cool, and was wondering if I could do this elsewhere as well. For example, I have a bunch of buttons that have a uniform shape but varied colors. Instead of making a PNG for each button, could I somehow use this color masking to use the same image for all of them but then set a tint color or something to change their actual color?
I receive very different addresses when allocating space
SKShapeNode(path: path) does not draw
Change the options in location services
Navigation Controller Embedded in Tab Controller - Tab Bar not visible
Does a singleton create retain cycle inside block?
I have a singleton and I want to capture it inside a block. I know that variables are retained inside a block because a constant copy of the objects passed is created and never deallocated unless using a weak instance of that object. The curiosity I have is whether the same behaviour is applied to a statically allocated variable. Here is my code (self is the sharedInstance of Class):
+ (Class *)sharedInstance
{
static Class *sharedInstance = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
sharedInstance = [[Class alloc] init];
});
return sharedInstance;
}
[self setBlock:^(NSArray *array)
{
self.property = [array firstObject];
}];
How to build Armadillo C++ lib to statically link to OpenBLAS in non-standard location
I am trying to build Armadillo C++ library (version 6.6) and it does build fine. My problem, however, is that I have separately downloaded the source code for OpenBLAS and built that. I want Armadillo to use the OpenBLAS that I built locally, and i'd like it to statically link it into the Armadillo library that is produced.
So,
- How do i tell the Armadillo CMake to use a specific OpenBLAS?
- How do i tell the Armadillo CMake to statically link the above OpenBLAS so it produces a libarmadillo that contains my OpenBLAS in it?
Integrating ios Share Extensions with Unity
UIAccessibility - containers
There's a "containers" rotor setting in voiceover - it allows you to quickly navigate through "high level" sections of the screen (swipe up and down). For example in calendar you have 3 items - navbar , contents, toolbar.
My app uses custom UIView subclasses and no matter what I try to do - all my views seem to belong to a single container - so i can't split them into logical sections. I tried putting them in separate views implementing UIAccessibilityContainer protocol and setting few of the accessibility properties on these parent views.
Does anyone know how to create multiple containers?
ShellExecute a cmd prompt with a specific working directory
I want to launch an elevated command prompt in Windows to a specific working directory. So for example, I have tried this:
ShellExecute(
hWnd,
L"runas",
L"cmd.exe",
NULL,
m_szSelectedFile,
SW_SHOW
);
Where m_szSelectedFile = L"C:\Users\User\Desktop"
ShellExecute
is documented as
HINSTANCE ShellExecute(
_In_opt_ HWND hwnd,
_In_opt_ LPCTSTR lpOperation,
_In_ LPCTSTR lpFile,
_In_opt_ LPCTSTR lpParameters,
_In_opt_ LPCTSTR lpDirectory,
_In_ INT nShowCmd
);
Unfortunately, it always launches to C:WINDOWSsystem32
. What am I doing wrong?
Swift filter instance of class base one 1 or more property criteria
Hi I'm developing and IOS app with Swift
. I'm trying to implement a search
function which will filter the result base one what user type in
my function should be like
func filterContentForSearchTex (searchText: String) {
}
For example i have an array restaurants
of class Restaurant
which have property name
, type
, location
. I want to filter only instance have property that either contain the searchText
.
can use any closure of other logic? Any help is much appreciate. Thanks!
Center SubViews in ParentView in Objective-C
I have the following code:
UIView *parentView = [[UIView alloc] init];
parentView.frame = CGRectMake(0, 0, 100, 100);
parentView.center = self.view.center;
parentView.backgroundColor = [UIColor greenColor];
UIView *subView = [[UIView alloc] init];
subView.backgroundColor = [UIColor redColor];
subView.frame = CGRectMake(0, 0, 50, 50);
subView.center = parentView.center;
[parentView addSubview:subView];
[self.view addSubview:parentView];
Which produces the following result:
Why is the red view not centered in the green view since they have the same center?
jeudi 7 juillet 2016
Fail to hide empty cells in UITableView Swift
I'm using UITableView in a swift application, and using my own custom UITableViewCell.
When trying to hide the empty cells in the UITableView, its still have the white background.
Under the UITableView I have a background image (UImageView).
I'v already try to hide those cells, and actually they are hidden, but I still have a white background, using this code:
override func viewDidLoad() {
super.viewDidLoad()
var tblView = UIView(frame: CGRect(x: 0,y: 0,width: 0,height: 0))
tblView.backgroundColor = UIColor.clearColor()
tableView.tableFooterView = tblView
var nipName=UINib(nibName: "CustomCell", bundle:nil)
self.tableView.registerNib(nipName, forCellReuseIdentifier: "CustomCell")
}
linker command code failed with exit 1
How to stop redirecting to another view when multiple select mode is on
I use the multiple select feature of UITableView, whenever I click the rows, it shows the detail view of that row. I also set allowsSelection to false but it doesn't affect. Here is my code and could anybody suggest on this case?
@IBAction func onEmailButtonPressed(sender: AnyObject) {
let isSend = (emailButton.title != "Cancel")
if isSend {
emailButton.image = nil
emailButton.title = "Cancel"
} else {
emailButton.title = ""
emailButton.image = UIImage(named: "email_white")
}
self.tableView.allowsMultipleSelection = isSend
self.tableView.allowsMultipleSelectionDuringEditing = isSend
self.tableView.allowsSelection = !isSend
self.tableView.setEditing(isSend, animated: false)
contactAgentBottomButton.hidden = !isSend
self.navigationItem.leftBarButtonItem?.enabled = !isSend
}
Visual Studio Community 2015 installation - Keeps getting stuck
So, I've looked really hard for an answer but I can't find it, so I thought some of you may have the same problem. I'm trying to install VS Community 2015, yet the installation keeps getting stuck in Microsoft Build Tools. I've tried checking the wait queue of the install software's process in the task manager, yet it says it's running perfectly. Frankly, I've reached the point where I want Visual Studio Express 2008 to come back.
I'm running Windows 10.
If you know something, or you've solved the same problem, I'd appreciate it if you gave me some tips.
Thank you!
Linux WaitForSingleObject?
Edit and replace an existing page in PDF in iOS? [duplicate]
This question already has an answer here:
I have to edit any visible page of rendered PDF and I have to save those changes made by user on that page of PDF. Is there any way around to achieve this without recreating the PDF with the edited page image?
C++ code not showing notification on top right in Ubuntu 14.04
I'm using libnotify-dev
in Ubuntu 14.04. The sample code is running and showing the notification but my code is compiling and running fine on the terminal but is not showing any notification. Why?
...
using namespace std;
notify_init("Sample");
const int minute=60;
int elapsedTime;
double secdiff;
time_t start,end;
time (&start);
while(true)
{
time (&end);
secdiff=static_cast<int>(difftime(end,start));
elapsedTime=secdiff;
if(elapsedTime%minute==0)
{
secdiff/=minute;
secdiff/=2;
string str=to_string(secdiff);
str+=" minute(s) have been passed.";
NotifyNotification* n = notify_notification_new ("Alert!",str.c_str(),0);
notify_notification_set_timeout(n, 15000); // 15 seconds
sleep(18);
}
}
How to change the background color of button in ios application
I am developing an application where I need to design the two button and when I have dragged the button on the story board they looks perfect but when I run the app then there is background color (blue) by default so can you please help e out.
Thanks in advance Here you can see the background color is blue but I need it to be transparent of white color so what can I do for it ?
Facebook sharing issue with Link and a screenshot
recently lanched app and when I click share fb buttun
first issue is what is black color from left and right side. The link is from itunes.
facebookSheet.addURL(NSURL(string: "https://itunes.apple.com/us/app/idxxxxxx"))
seconf issue is How to have link from itunes and add imege both??
acebookSheet.addImage(UIImage(named: "logo.png"))
If I put togher it will only display link.
UIButton can't be touched while animated with UIView animateWithDuration
I have the following code:
[UIView animateWithDuration:0.3
delay:0.0
options:UIViewAnimationCurveEaseOut | UIViewAnimationOptionAllowUserInteraction
animations:^{
CGRect r = [btn frame];
r.origin.y -= 40;
[btn setFrame: r];
}
completion:^(BOOL done){
if(done){
[UIView animateWithDuration:0.3
delay:1
options:UIViewAnimationOptionCurveEaseIn | UIViewAnimationOptionAllowUserInteraction
animations:^{
CGRect r = [btn frame];
r.origin.y += 40;
[btn setFrame: r];
}
completion:^(BOOL done){if(done) zombiePopping = 0; }];
}
}];
The problem is, it seems the button doesnt respond to touches while being animated even though i'm using UIViewAnimationOptionAllowInteraction
, which is a bit weird to me.
Maybe this most be done with Core Animation to work? and if so, how would i go about that?
How to disable filtering option for a QTreeView or Model
Terminating since there is no system app?
Has anyone been experiencing the error message "Terminating since there is no system app" lately in XCode?
I have a CoreAudio app (built with The Amazing Audio Engine framework) running on iOS 8.1 and XCode 6.1. Since XCode 6.1 (or/and iOS 8.1) my app randomly crashes (generally not long after starting to run) and my iPad displays a black screen with the white apple logo. Like the boot up screen but only for a few seconds. Then the ipad goes back to the locked screen.
The log windows says : "Terminating since there is no system app". No very helpful ;^(
Anyone is having the same issue? Thanks.
iTunes Connect can't see my BundleID
How to upload more than 1 image to AWS S3
Keep my Clang Based tool from analyzing header files in source code?
I'm writing a stand alone tool based on LibTooling with a RecursiveASTVistor, and I don't want to have to go through the contents of header files stored in source code. Do I need to change the compilation database? I've been using this little hack to keep my tool from crashing, but I don't want my tool to analyze any header files at all included in the source code I'm dealing with.
bool VisitDecl(Decl *D) {
FullSourceLoc FullLocation = Context->getFullLoc(D->getLocStart());
const auto &SourceManager = Context->getSourceManager();
if (FullLocation.isValid() && !SourceManager.isInSystemHeader(FullLocation) && Context->getSourceManager().isInMainFile(D->getLocation()))
}
What is the difference between Pan and Swipe in iOS?
Sounds simple .. Hold the Trackpad, move the finger, release .. But somehow swipe is not being triggered (pan is triggered instead)
UISwipeGestureRecognizer *swipeGesture = [[UISwipeGestureRecognizer alloc]
initWithTarget:v action:@selector(handleSwipe:)];
swipeGesture.direction= UISwipeGestureRecognizerDirectionUp;
[v addGestureRecognizer:swipeGesture];
Pan is recognized by the above sequence instead.
UIPanGestureRecognizer *panGesture = [[UIPanGestureRecognizer alloc]
initWithTarget:v action:@selector(handlePan:)];
[v addGestureRecognizer: panGesture];
If pan is commented, swipe is recognized by the same gesture .. With this, 2 questions:
- What is the difference then between a pan and a swipe?
- How can one simulate a swipe on iPhone simulator?
Create Horizontal ScrollView in Swift
I want to know how to create a horizontal scroll view in Swift. I also want to know how to add buttons to the scroll view. An excellent example of what I'm essentially asking for is in the game "Cut the Rope."
In the picture you're presented with a picture (which you can click on) of a "fabric box." There are other different types of boxes that, with scrolling, you can access them. How would I do something similar to this?
Input from UITextField connected from storyboard to Swift view controller file
Using Swift, how do I get the input from a UITextField
?
In my Main.storyboard, I have chosen a "Text Field" from the premade components and dragged it onto my storyboard.
Now how can I access its value in my ViewController.swift?
What I'm currently doing:
I ctrl+drag the text field into my ViewController.swift file. Then in the popup-box I choose "outlet" and name it "myInput".
Then in another function, I access its value by using self.myInput.text
.
Is this the only way to access its input? Is my approach following Swift conventions?
Debugging an App, that needs a URL to a server
I have a Xamarin Solution with an Android, iOS, and Windows mobile solution. I also have a Web Server that sits on localhost:XXXX. I need to be able to access the URI endpoints on my local, while debugging on Mobile.
While the Web Server is running I go to fiddler, and compose http://localhost:XXXX/api/Locations
and everything is correct, I get the JSON data and life is good.
However when debugging the App on any phone, I suspect the endpoint on the phone is trying to access it's own "localhost". Is there a hosts file that I can edit on the emulators? or another solution?
iOS: Get displayed image size in pixels
In my app, I'm displaying an image of a rectangle from the assets library. The image is 100x100 pixels. I'm only using the 1x slot for this asset.
I want to display this image at 300x300 pixels. Doing this using points is quite simple but I can't figure out how to get UIImageView to set the size in pixels.
Alternatively, if I can't set the size in pixels to display, I'd like to get the size in pixels that the image is being displayed.
I have tried using .scale
on the UIImageView and UIImage instances, but it's always 1. Even though I have set constraints to 150 and 300.
clang compile failed on mariadb
system is CentOS(VirtualBox) x64
I had "yum install" and "yum check" cmake clang gcc libstdc++ and compat-libstdc++*
I had link cmake to clang
I had compile a "HelloWorld" program by clang successed
then,
I try to compile mariadb'code use : "cmake . -DBUILD_CONFIG=mysql_release".
I got error like this:
...
CMake Error at /usr/share/cmake/Modules/CMakeTestCXXCompiler.cmake:54 (message):
The C++ compiler "/usr/bin/clang++" is not able to compile a simple test
program.
...
/usr/bin/ld: cannot find -lstdc++
...
How can I fix this problem? Thanks very much!
(Please forgive me for my poor English T_T)
Cocoa pods objective c files in Swift project. Bridging issue
I downloaded code from here:
https://github.com/QuickBlox/quickblox-ios-sdk
wich include sample-chat-swift example folder where seems somehow guys created a framework.
In my case if I just use cocoa pods to pull code into my project Xcode says to me that we can't find any of downloaded classes. So I am sure that is problem with bridging but my question what are the steps I need to do to create framework like guys did in theirs example.
Or do I need to bridge each files manually? If so I guess it can take so much time.
How to add elements of an array with themselves?
I want to add an element of an array with itself. Here is some of my code :
for (j = 0; j <= N - 1; ++j) {
Phi[j] = Randf();
G_0[j] = 0;
} ...
...
for (l = 0; l = N - 1; ++l) {
G_0[l] += Phi[l] * Phi[l];
}
But compiler yields this error :
Error C2114 '+=': pointer on left; needs integral value on right
I don't know what to do. I've researched this type of error but either I cannot find anything useful or I'm so clueless that I don't understand what I've found.
How can I add an element of an array with itself? Thanks in advance.
Trim transparency of an UIImage
I was wondering what would be the best way to trim the "canvas" of an UIImage (pretty much like any image editor allows out there)
Now, the previous example is not a single UIImage. It's actually 2 UIViews. So clipping the superview against the blue box would do the trick, but I guess I am looking into the best possible way to do this. Given that there could be several blue boxes in the "canvas".
Is there a faster way than going through every pixel?
Thanks!
mercredi 6 juillet 2016
Application icons is pixelated
I'm trying to set an icon for my app, however the icons derived from the original image is pixelated and looks bad, I tried to provide the app icon gear application with images of different sizes, however the result is still unpleasant! Should I provide it with images of higher resolution or lower resolution to get better results? In the question in the link under there's an answer providing a matrix provided by Apple for icon sizes. My question is, should I use these sizes strictly, or consider them as a lower border not to go under, or consider them as a ceiling not to exceed? the question's link
entry point (_main) undefined xcode 6
I can't for the life of me find a solution to this! I'm using Swift. All of a sudden I get this error:
Undefined symbols for architecture i386:
"_main", referenced from:
implicit entry/start for main executable
ld: symbol(s) not found for architecture i386
It doesn't matter what simulator/device I try to run for, I still get it:
Undefined symbols for architecture x86_64:
"_main", referenced from:
implicit entry/start for main executable
ld: symbol(s) not found for architecture x86_64
What is this?! I've almost removed everything from my project. I.e. all frameworks and everything. It's still there.
Please help me
Determining which static libraries are linked unnecessarily
I want to cut down library dependencies on some C++ executables I'm compiling for Linux with GCC. There is a list of probably 40 static libraries that being linked. I want to determine which ones are unnecessary, and I would rather not try removing them one at a time to find out.
Is there an option in GCC to make it warn about libraries that are linked but don't resolve any symbols?
Are there any Linux tools available that will help me out?
To be clearn, I'm not concerned with unused code being linked into the executable. Rather, I'm concerned with the unnecessary build dependencies. I'd like to cut down my build times.
find string in map function c++
I've never used map lib in C++ and I'm implementing a graph adding cities on it, and this is what I'm doing:
I read a city from a txt file, then I look for it in mymap. If I find it, don't need to add in the graph and in the map, if not, I create a integer key for it,put in the map and then add in the graph.
The problem is, I don't know how to find a string in mymap, the find function works just for char,right?
mymap is
map<int,string> cities;
example cities["New York"] = 1; cities["Brazilia"] = 2;
Check for container type
How can I check for a type of container? I.e.
template <class Container1>
void func (Container1 &cont_1)
{
if (cont_1 is list container)
//do stuff
if (cont_1 is vector container)
//do other stuff
}
The only two possibilities I have are list and vector. Note that I don't know the type of values within list
/vector
, i.e. vector<char>
or vector<int>
, etc. is possible, thus I just want to get the information of getting a vector or a list.
I came across typeid
and type info
, but did not really get it done.
iOS background execution and password protection
In Apple Doc Understanding When Your App Gets Launched into the Background says
When password protection is enabled on the device, the system does not launch an app in the background before the user first unlocks the device.
If app is depending on region monitoring then it will not work, Users cannot keep unlocking there iPhones after every few minute that some app will wake in background.
How an region monitoring app will wake in background and do its stuff when an password protected device will not let the app launch in background?
How to check if file is appropriated with database driver in Qt
Variable used before being initialized in function
I'm making a ro sham bo game. Functions in swift are different than what I have used before. I keep getting an error:
Variable used before being initialized in function
What am I doing wrong?
import Foundation
import UIKit
class Result: UIViewController {
var rval: Int?
var chosen: Int?
func determineWinner() -> Int {
var returnval: Int
if (chosen == rval){
returnval = 2
}
else if (chosen == 1 && rval == 3){
returnval = 1
}
else if (chosen == 1 && rval == 2){
returnval = 0
}
else if (chosen == 2 && rval == 1){
returnval = 1
}
return (returnval)
}
@IBOutlet weak var wl: UILabel!
@IBAction func PlayAgain(sender: AnyObject) {
}
override func viewDidLoad() {
print(chosen)
}
}
Does anyone know if this is possible using AVFoundation?
I have created a slider that generates a tone. I need it to generate two tones but xcode is producing a plethora of errors any way I attempt it - is this impossible?
Here is some of the set up I'm using:
tone = AVTonePlayerUnit()
slider.value = 0.0
let format = AVAudioFormat(standardFormatWithSampleRate: tone.sampleRate, channels: 1)
print(format.sampleRate)
engine = AVAudioEngine()
engine.attachNode(tone)
let mixer = engine.mainMixerNode
engine.connect(tone, to: mixer, format: format)
do {
try engine.start()
} catch let error as NSError {
print(error)
}
EDIT:
I have solved the problem by creating a separate class for the AVTonePlyerUnit. I have a separate problem with creating a volume slider for the generator.