w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML Categories
Ephemeral storage along with EBS
This would technically work but bare in mind that you will still be charged on the I/O for reading and writing to the backups on EBS. An alternative and possibly more cost effective method you could consider is backing up to S3 - in this way you only pay for the storage that you use and not for provisioning a whole EBS volume. To follow on, EBS volumes may only be attached to one instance at a time. This may be an issue for you if you have multiple instances running at one time. Should the instance attached to the EBS volumes go down, you will need to remount these to another instance. Using S3, each instance now and in the future can have access to the S3 bucket.

Categories : Amazon

Heroku ephemeral storage, Sendgrid, and attachments
Heroku's /tmp directories are unique to each dyno. So your Web Dyno saves a file in its /tmp directory, then your worker looks in its /tmp directory and cannot find it. The best option is likely refactoring your code (that way you aren't clogging up your Web Dyno's resources creating and writing files to disk). However, if you really want to avoid it, you could store your files temporarily on S3 [tutorial] or some other external storage mechanism.

Categories : Django

Running over an unrolled linked list takes around 40% of the code runtime - are there any obvious ways to optimise it?
I feel following suggestions can help you optimize the code a bit if not completely: Use initialization over assignments wherever possible Prefer pre-increment over post for better speed.(believe me, it does make a change) Apart from that I think the code is just fine. There are some pros and cons of each DS..you gotta live with it. Happy Coding!

Categories : C++

newbie: lamp stack to dart vm
Yes, you can replace PHP with Dart and run it via Apache. See this article. There are some libraries to also enable connecting to MySQL (like this one). The Dart VM is unrelated to client access; the Dart VM on the server would only be used for server-side Dart. Client-side Dart is generally converted into JavaScript using dart2js (via pub build) and this will work with all modern browsers.

Categories : Dart

newbie: is it possible to wordpress theme with LAMP stack
Of course it is possible, but it doesn't make any sense and integrating the two platforms would still require a developer and most likely would ultimately be more work (not to mention be a lot harder to update and maintain both from an admin perspective and a development perspective) than simply mimicking the design or functionality of one of the Wordpress theme home pages you like while staying in your current platform and framework. In short, yes it's technically possible, but realistically it doesn't particularly make sense to do so. The only reason I can think you might want to use Wordpress for the home page and your own custom platform for the rest of the site is to avoid paying your developer for more hours to build the homepage on your platform, but integrating Wordpress with your

Categories : Wordpress

Where do I upload website files onto ec2 lamp stack?
According to bitnami wiki it is in /opt/megastack/apps - here you create a folder with your app and apache serves it in a vhost you configure. It's a good practice to check /etc/httpd/ folder for the confifugration files and DocumentRoot. Note, make sure that you remove the index.html file you find by default in the folder. The index.html has a higher priority in being served than the index.php in the bitnami stack configuration.

Categories : Amazon

Can Microsoft Azure SQL Server utilize FileTable / Blob Storage?
No, SQL Azure does not support filetable, nor filestreams. You can store your files in Azure Blob Storage (see How to use the Windows Azure Blob Storage Service) and store metadata about files (name, type, URL location) in SQL Azure DB. For a list of SQL Server feature limitations in Windows Azure SQL Database refer to Azure SQL Database Transact-SQL information. For a list of ALTER DATABASE options supported by Windows Azure SQL Database refer to ALTER DATABASE (Transact-SQL).

Categories : Sql Server

why does my LAMP stack show my image when I navigate to it w/ a URL but not when I load it w/jQuery and PHP
You are getting symbols instead of an image since you are trying to send binary data without specifying what that data is. Add header to your renderPicture.php file : header('Content-Type: image/png'); And it will return the desired png image. Cheers

Categories : PHP

Can the Java Metro stack be used in commercial closed source projects?
After some more research I found that the Netbeans framework is licensed with the same construct (GPLv2 and CDDL) and luckily the guys at Netbeans took the time to explain the how what and why a bit: Netbeans license FAQ Here is what they say about dual-licensing: Dual-licensing is the practice of distributing identical software under two (or more) different sets of terms and conditions. When software is dual-licensed, recipients can choose which terms under which they want to obtain the software. The two usual motivations for dual-licensing are business models and license compatibility. [...] Additional search for details about CDDL brought me to this site containing a nice summary: why the dislike for cddl Here is one of the parts relevant that is to my question: CDDL i

Categories : Java

How would I portably implement aligned stack storage in C++03?
In his Guru Of The Week #28 column, Herb Sutter uses a union but it's less robust than Boost's efforts. Boost's aligned_storage solves the gory details for you. If you look at its implementation, you'll see it uses MSCV's __alignof or GCC's __alignof__ as well as another template: type_with_alignment. From my own codebase, I once used (derived from the GOTW link above): #if defined(_MSC_FULL_VER) && (_MSC_FULL_VER >= 150020706) # pragma warning(push) # pragma warning(disable: 4371) #endif // #if (defined(_MSC_FULL_VER) && (_MSC_FULL_VER >= 150020706) union AlignedStorage { char storage[sizeof(T)]; int16 dummy0; int32 dummy1; int64 dummy2; float dummy3; double dummy4;

Categories : C++

Using PHP curl to store object with open stack API file storage
For Anyone whos having the same issue i solved the problem the following way: $url = 'http://myurltouploadfileto.com'; $fp = fopen('http://urlToFileToUpload.com'); $ch=curl_init(); curl_setopt($ch, CURLOPT_HTTPHEADER, array('X-Auth-Token:sometoken')); curl_setopt($ch, CURLOPT_PUT, true); curl_setopt($ch, CURLOPT_INFILE, $fp); //this was the main one that i was missing curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_HEADER, TRUE); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT"); This seemed to resolve it and upload the file from the url to object storage server.

Categories : PHP

How to know if the last closed activity was the last activity in the stack in Android?
Maintain the activity stack of your application. You can achieve this by many ways: If your application has multiple entry points, then you can track which activities your user has opened and where they currently are, and accordingly when the the stack is pushing out its last item, pop the service. If your app doesn't have multiple entry points, then you can just monitor the onStop of your Launcher activity. If you want to also stop your service while multi-tasking, you'll have to be more creative with intents and sending a few flags as payloads. Maybe stop the service onStop if a flag isn't set by starting another one of your activities.

Categories : Android

Why can a socket connect() to its own ephemeral port?
It is a logic bug in your code. First off, only newer versions of Windows use 5000–65534 as ephemeral ports. Older versions used 1025-5000 instead. You are creating multiple sockets that are explicitly bound to random ephemeral ports until you have bound a socket that is within 10 ports less than your target port. However, if any of those sockets happen to actually bind to the actual target port, you ignore that and keep looping. So you may or may end up with a socket that is bound to the target port, and you may or may not end up with a final port value that is actually less than the target port. After that, if port happens to be less than your target port (which is not guaranteed), you are then creating more sockets that are implicitly bound to different random available ephemera

Categories : Windows

Boost::asio UDP Broadcast with ephemeral port
OK, I found a solution to this issue. Under linux it's not necessary, but under windows I discovered that if you are neither binding nor connecting, you must have transmitted something before you make the call to asynch_recieve_from(), the call to which is included within my this->asynch_receive() method. My solution, make a dummy transmission of an empty string immediately before making the asynch_receive call under windows, so the modified code becomes: m_socketPtr->set_option(boost::asio::socket_base::broadcast(true)); // If no local port is specified, default parameter is 0 // If local port is specified, bind to that port. if(localPort != 0) { boost::asio::ip::udp::endpoint localEndpoint(boost::asio::ip::address_v4::any(), localPort); m_socketPtr->bind(localEndpoint); } i

Categories : Windows

How can i check that EC2 AMI image is stored on EBS not ephemeral stoarge
Yes, the micro instances always use EBS root, so you don't have to do anything special. If you 'stop' your instance, and later start, it's moving your hard drive to another computer and rebooting. If you terminate your instance, your EBS drive will be fine as long as "delete EBS drive on termination" is not set on your drive. When you use other instances, you'll have to verify the AMI type. Not all AMIs are available in all combinations: EBS vs ephemeral 64 bit vs 32bit PVM vs HVM (Everything is PVM except the really high-end Compute Cluster) When you first get started in the cloud, EBS is a big deal. But as you get to be a cloud expert, you'll prefer non-EBS instances. EBS will only be used on a few servers, like your database or your syslog server. Most of your app should be stat

Categories : Web Services

How to run AWS instances with attached ephemeral disks with the fog library
Looks like the command line equates to <devicename>=<blockdevice>. So we should be able to do that in fog in one of a couple ways. The model version using your values would be something like: compute = Fog::Compute.new(...) compute.servers.create( :block_device_mapping => [ { 'deviceName' => '/dev/sdb', 'virtualName' => 'ephemeral0' }, { 'deviceName' => '/dev/sdc', 'virtualName' => 'ephemeral1' }, { 'deviceName' => '/dev/sdd', 'virtualName' => 'ephemeral2' }, { 'deviceName' => '/dev/sde', 'virtualName' => 'ephemeral3' }, ], :image_id => 'ami-xxxxxxxx' ) Or the lower level, more direct path might look like: compute.run_instances( 'ami-xxxxxxxx', 1, 1, :block_device_mapping => [ { 'deviceName' => '/dev/sdb', 'virtualName' => 'ephemeral0' }

Categories : Ruby

AWS Windows Server 2012 Ephemeral Drives... Why So Many?
Not a bug - but a change to the Windows 2012 AMI configuration. Previously, you could add ephemeral volumes, but it wasn't clear how many you could add. Now, to "fix" that, they've put them all there to show how many you can have, and then you remove the ones you don't want. ie - n most cases - all of them. I'm not convinced it's a particularly good change, but that's the answer I got from support.

Categories : Amazon

ephemeral disk noted listed on created ami Amazon EC2
You have two options to enable ephemeral storage on an instance. Enable it at launch. Can be done in the console or command line tools. Enable it with you register a snapshot as an AMI. By default it will not map ephemeral storage, this is something you have to explicitly enable.

Categories : Amazon

Increase ephemeral ports by adding extra ethernet interface
It's a limitation of the network protocols. Both TCP & UDP, for instance, have 16 bit source and destination ports. Even if you could increase the number of ports no one could address them.

Categories : Linux

ARC: When is ephemeral view controller delegate memory reclaimed with weak reference
- (void)viewDidLoad { [super viewDidLoad]; BarViewController *bar = [[BarViewController alloc] init]; // does this assignment create a "strong" reference i.e. increase retain count by 1? NO, you set the delegate as weak so the compiler will not strongly point to any object (in this case SELF) when bar.delegate is assigned. bar is a local variable so it will automatically retain the BarViewController object as long as the functions does not return (increasing the count by 1 when assigned and deleting it when the function ends), or as long as you dont set it to NIL. If you do not specify the delegate var to be weak, then yes, you will increase the retain count to SELF by 1 and you might end up with retain cycle. That is way delegates should always be weak. bar.delegate = s

Categories : Objective C

Finalizing a Cursor that has not been deactivated or closed or database not closed error
When you are done with the cursor, you need to call Cursor.close(). Leaving it not closed leads to memory leaks. E.g.: Cursor cursor = null; try { cursor = getContentResolver().query(myUri, MY_PROJECTION, null, null, null); if (cursor != null && cursor.moveToFirst()) { // moar code } } finally { if (cursor != null) { cursor.close(); } }

Categories : Android

How to make vim search wrap more obvious?
It's hard to change that behavior, you'd have to override all built-in search commands (/, n / N, *, #, etc.) and any custom (plugin) mappings. If this is bothering you, maybe :set nowrapscan is worth a try. You can then still "manually" wrap via gg / G, which will soon go into your muscle memory, yet keep you alert.

Categories : Vim

Other than the Obvious - Why do Oracle Objects become un-compiled
It's hard to speculate. A lot of errors come from changes to dependencies or permissions. To see the problem with a specific object, use this query: SELECT * FROM All_Errors WHERE Name = '<invalid object name>' AND Owner = '<invalid object owner>' The <invalid object name> and <invalid object owner> (meaning the schema) must be in uppercase unless the object name was defined using double-quotes and a non-uppercase name, for example CREATE TABLE "BadDecision" AS .... To see errors for all invalid objects, do this: SELECT * FROM All_Errors WHERE (Owner, Name) IN ( SELECT Owner, Object_Name FROM All_Objects WHERE status = 'INVALID')

Categories : Database

Valgrind won't detect obvious errors
I am assuming you are using the gcc compiler. I just gave that a little testing and my valgrind did report the errors only when I had the program built with -O0. With optimizations on (-O3) valgrind did not report the errors. I suppose that would be because the compiler is able to remove the uninitialized jump because the value never changes and is removed entirely. Since you are doing that for exercise you might try to figure out which compiler options work for you. In case you don't know yet what that is, look for "Debug" or "Release" build and switch to "Debug". HTH, Moose

Categories : Linux

Maxima missing obvious simplifications
You can try load (scifac); declare("`", alphabetic); expr: (-8*m5*sin(Te)*Te`^2*L1^2-8*m4*sin(Te)*Te`^2*L1^2); gcfac(expr); 2 2 (%o2) - 8 (m5 + m4) sin(Te) Te` L1 I use ` (backtick) not ' (apostrophe). Maybe optimize can be useful.

Categories : Misc

Force git to manual merge even in "obvious" situations
git merge drivers exist to efficiently detect and resolve potential conflicts between changes in two histories. Its smudge and clean filters exist to apply and remove changes that are needed only in your worktree, that don't belong in a published history. What you're doing is a smudge, a local-only change nobody else needs. merge is a conflict-resolver, not a smudger. You've already got the code to apply your local changes even if nothing else has changed upstream, you can run that as a smudge filter directly by feeding it the same file as both inputs.

Categories : GIT

Instruments not detecting obvious memory leak
From my observation: the empty NSArray is basically a singleton instance. You can't create memory leaks in this way, because your app will always have a reference to the empty array "singleton". This will show you that all empty arrays point to the same memory address: NSArray *array1 = [NSArray array]; NSArray *array2 = [NSArray arrayWithArray:array1]; NSArray *array3 = [NSArray arrayWithArray:@[]]; NSArray *array4 = @[]; NSArray *array5 = [@[] copy]; NSArray *array6 = [[NSArray alloc] initWithArray:[[NSArray alloc] initWithArray:@[]]]; NSLog(@"%p", array1); NSLog(@"%p", array2); NSLog(@"%p", array3); NSLog(@"%p", array4); NSLog(@"%p", array5); NSLog(@"%p", array6); No matter where in your application lifecycle you log the address of the empty array, it will always be the same. Yo

Categories : Objective C

How is ASP.Net Routing accomplished given there is no obvious ISAPI mapping?
So there are at least two pieces to this question: The first is if you are running in IIS in classic mode versus integrated mode. Classic mode will make things behave like IIS 6, where everything is an ISAPI filter, including ASP.NET itself. Integrated mode takes advantage of the fact that IIS 7 was rewritten from the ground-up and now uses modules instead. Secondly, the short answer of why IIS knows how to forward a URL to ASP.NET is the Routing Module in the IIS 7+ pipeline; ISAPI filters are now part of the ISAPI Filters Module. For a visual description of how the IIS 7+ pipeline works from a Routing/URL-Rewriting perspective, read IIS URL Rewriting and ASP.NET Routing So the good news is if you are very much attached to the ISAPI filter approach you can use the classic mode of IIS.

Categories : Asp Net

Application gets closed when terminal is closed, how to stop this?
Use nohup to prevent child processes from being killed when the terminal closes. spawn nohup /usr/bin/firefox https://www.google.com/ I assume there's more to the script, since there's no need to use Expect just to start firefox.

Categories : Python

Fixed the rogue bracket at the end, but the tabbing here still makes it a little odd. At least it's not as obvious
there are attributes like layout_toLeftOf or layout_below. Use them with the id of the referenced checkbox. For example: <CheckBox android:id="@+id/chechbox_bike" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/Bike" android:onClick="onCheckboxClicked"/> <CheckBox android:id="@+id/chechbox_car" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/Car" android:layout_below="@id/checkbox_bike" android:onClick="onCheckboxClicked"/> See the attribute android:layout_below="@id/checkbox_bike" I added to the second checkbox. A short explanation: A relative layout is used to place views in "relation" to each other. Without any information they are

Categories : Android

Does the SQL Server CE engine have to be told the commandtype is text if that should be obvious?
... but don't know if the commented line is needed No. Not because it's obvious but because it happens to be the default. From MSDN: Property Value One of the CommandType values. The default is Text. Having said that, it certainly is not bloat-code and I might include it, just to make the code a little less ambigious to read.

Categories : C#

Asynchronous Cocoa - Preventing "simple" (obvious) deadlocks in NSOperation?
If the main thread needs to be message synchronously during the operation, I'm wondering if there is a canonical solution that an operation subclasser can implement to prevent this type of deadlocking. There is. Never make a synchronous call to the main queue. And a follow-on: Never make a synchronous call from the main queue. And, really, it can be summed up as Never make a synchronous call from any queue to any other queue. By doing that, you guarantee that the main queue is not blocked. Sure, there may be an exceptional case that tempts you to violate this rule and, even, cases where it really, truly, is unavoidable. But that very much should be the exception because even a single dispatch_sync() (or NSOpQueue waitUntilDone) has the potential to deadlock. Of co

Categories : Objective C

How to utilize SwingWorker and/or Timer?
Timer executes in the EDT and the SwingWorker makes work in another threads. I really like this example Swing Worker example Note that the Swing timer's task is performed in the event dispatch thread. This means that the task can safely manipulate components, but it also means that the task should execute quickly. If the task might take a while to execute, then consider using a SwingWorker instead of or in addition to the timer.

Categories : Java

How can i utilize/implement TFLogv
You could do something like this: void MyLog(NSString *format, ...) { va_list argList; va_start(argList, format); NSString *message = [[NSString alloc] initWithFormat:format arguments:arg_list]; va_end(argList); // send to TestFlight TFLog(@"%@", message); // TODO: save to my log // { your code here } } And then call MyLog instead of TFLog.

Categories : Iphone

Wordpress utilize JSON
Try something like this.... $json_string = file_get_contents('url'); $json_array = json_decode( $json_string, TRUE ); print '<pre>'; print_r( $json_array ); There are a couple of different ways to do this, but the basics are... Get the json string from source, decode it ( the TRUE in the json decode will decode it into an associative array ) and then you should be able to treat it like any array you want to. Good Luck.

Categories : Json

How to best utilize DBContext with a Web API application
DbContext is not thread-safe, so making it static is not a good thing for server code. The overhead of creating a DbContext is low so I do not see why we have to avoid making it instance variable.

Categories : C#

Does java utilize the GPU for painting
It should be. Best way to know how to proceed would be to do a test and load a bunch of fake images, and makes sure you don't drop frames. Even if you use the GPU it might not be fast enough on your device, so recommend testing regardless.

Categories : Java

How to utilize a UISegmentedControl With a UITableViewController?
Have all the cells you need available in your table view controller. In your table view's datasource methods (i.e. numberOfSections, numberOfRowsInSection, cellForRowAtIndexPath) you can set all the correct numbers and data for the two states. When the segmented control changes, you can do two things. Either you simply reloadData, as was suggested before, but then you do not get any animations. Or you use insertRowsAtIndexPaths:withRowAnimation: and deleteRowsAtIndexPaths:withRowAnimation: to get the animation effect. E.g. showing sections 1-2 in case 1 and sections 3-6 in case 2 (section 0 being the top section); each section has 2 rows - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { return _control.selectedSegmentIndex == 0 ? 3 : 4; } - (NSInteger)tableView:

Categories : IOS

LAMP attendance system
Easy enough, to be honest... $numOfEmployees = 8; $concatArray = array(); foreach($attendance as $k => $v) { $concatArray[] = array("employeeID" => $k, "attendance" => $v, "remark" => $remark[$k]; } If your attendance table is in anything like SQL, you could go about it with foreach on the above mentioned concatArray: foreach($concatArray as $key => $value) { $remark = $value['remark']; // sanitize remark for database $query = "INSERT INTO employees (ID, Date, Status, Remarks) VALUES ({$value['employeeID']}, NOW(), {$value['attendance']}, '{$value['remark']}');"; // perform the actual query } Keep in mind that this is a very general example, making a lot of assumptions about the database. As Frits notes, the remark field should be sanitized,

Categories : PHP

Can you install lamp onto a network hdd?
You can install things on an external hard drive, but you cannot run them there. You can only run them on the computer to which you've attached the external hard drive. In other words, you need a computer to run a LAMP stack, and if you have a computer, it doesn't matter if the computer is using an internal or external hard drive. The only difference between an internal hard drive and an external drive is that external hard drives are often (but not always) slower.

Categories : Linux



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.