w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
iOS -- initializing a UIButton forces iAd to dissapear
The issue is - you are using the same frame to show button and the banner. As a result, the button is covering it fully. Reduce _frame.size.height inside showBanner function and you will see the banner.

Categories : IOS

Spring Forces in D3.js Force directed layout?
In D3 force-directed layout, the spring forces are defined using the gravity method that defaults to 0.1 if not set. Check out this fiddle of the same example you mentioned with gravity set to 0.9. The "weak geometric constraints" mentioned in the linkDistance documentation are talked about further here. "gravity is implemented as a weak geometric constraint similar to a virtual spring connecting each node to the center of the layout's size. "

Categories : Javascript

Mysterious forces in d3 force directed layout?
I believe what you are seeing is the lack of gravity. Without gravity the nodes will not tend towards the center of the screen. I was able to get the desired result for your edge case by setting force.gravity(1) and the charge for the nodes to -100. https://bl.ocks.org/david4096/6264697

Categories : Javascript

fopen, fprintf and fclose forces socket connection end
I just found the problem and its solution. The injected app was configuring sockets on non blocking mode. Any little delay was making it throwing WSAEWOULDBLOCK (10035 error code). All i had to do to fix it was to retry the recv request if i get any error INT val = 0; while(temp < 2) { val = recvPacket(socket,recv_gs_buffer+writer,2 - temp,flags); if(val > 0) { temp += val; writer += temp; } } And val = 0; while(temp < size) { val = recvPacket(socket,recv_gs_buffer+writer,size - temp,flags); if(val > 0) { temp += val; writer += temp; } }

Categories : C++

Putting an image into nav bar div forces the text to stick to the bottom
Your img should be placed inside another li as an img is not a valid child of a ul. Or perhaps it should come out of the list entirely and be placed before the ul not sure what your design is like but I think it'd make more sense to bring it out of that list entirely.

Categories : HTML

How can I write a route that forces to a single controller/action?
I think you are looking for routes.MapRoute( name: "Default", url: "{*url}", defaults: new { controller = "Test", action = "Index"}); Forces all requests to the TestController with the method Index.

Categories : C#

File saving forces jtable cell to commit all changes
inside the action listener handling the save button you can do something like: if (table.isEditing()) table.getCellEditor().stopCellEditing(); (from http://tips4java.wordpress.com/2008/12/12/table-stop-editing/)

Categories : Java

Djcelery forces the use of 'database' backend, how to properly bypass it?
Can't you just set redis as CELERY_RESULT_BACKEND? See the docs for reference. django-celery overrides default celery.backends.database for a good reason: you simply can't use SQLAlchemy with Django ORM. I see no point in routing a database backend to redis.

Categories : Django

TCPMON forces you to break the target endpoint into HOSTNAME and PORT
I don't know specifically about AXIS, but in CXF you can add loggers to the endpoint configuration bus. Same for core JAX-WS where you can specify a handler chain that might include a logging step. Command line tools that aren't part of the ws implementation (either client or server) don't know the application or protocol specifics, so they can't filter on that specific endpoint request. You could take the output from tcpmon and post-process it to locate only the endpoint you want by looking for: POST webservices/SOAProvider/plsql/xxcpin_ap_supplier_pkg/ HTTP/1.1 or something very similar in the data stream.

Categories : Java

Is this true: "In MySQL, fetching a column value forces a read of the entire row"?
I guess this is not correct. I remember clearly my graduation teacher telling us cases where the performance of a certain application was really bad because of the use of 'SELECT *...' instead of using 'SELECT id...', for example. Maybe you can try to make a real example running a timestamp before and after a sequence of SQL queries in both ways and comparing its results. EDIT: Trying a simple Schema on SQL Fiddle (http://sqlfiddle.com/#!2/32954/2) with SELECT * FROM table and SELECT id FROM table, the average time for the '*' one was about 10 ms for 95 rows and the average time for the 'id' one was 1 ms for the same 95 rows. I don't know if SQL Fiddle is a trustable source, but I think it can give us an idea.

Categories : Mysql

Adding border forces column to next line when using Responsive Grid System?
Use box-sizing: border-box;. This rule will make the border part of the calculation of the element's width. Browser Support

Categories : CSS

Cocos2d Android Lock Screen or Leaving Game Forces Restart
add this line in your onstop() method CCDirector.sharedDirector().end(); and you need to write an onDestroy() method to remove all the instances when you close the game.

Categories : Android

The lack of non-capturing Task.Yield forces me to use Task.Run, why follow that?
You don't have to put the Task.Run in DoWorkAsync. Consider this option: public async Task UIAction() { // UI Thread Log("UIAction"); // start the CPU-bound work var cts = new CancellationTokenSource(5000); var workTask = Task.Run(() => DoWorkAsync(cts.Token)); // possibly await for some IO-bound work await Task.Delay(1000); Log("after Task.Delay"); // finally, get the result of the CPU-bound work int c = await workTask; Log("Result: {0}", c); } This results in code with much clearer intent. DoWorkAsync is a naturally synchronous method, so it has a synchronous signature. DoWorkAsync neither knows nor cares about the UI. The UIAction, which does care about the UI thread, pushes off the work onto a background thread using Task.Run. As

Categories : C#

Multiple Build Folders (multiple clients, mulitask, multiple targets) using Grunt (Yeoman)
There's really no best practice out there beside what's recommended for PG 3. For multiple clients, you may want to modify your gruntjs. This is my project structure, where assets folder contain data for different clients: And here is my gruntjs file. It use ImageMagik to create all the necessary launcher icons. Build and deploy for over the air installation. You get the idea... /*** * Package script for MobileStore ***/ 'use strict'; // require package.json: /* { "name": "MobileStore", "version": "1.0.1", "devDependencies": { "grunt": "~0.4.1", "grunt-contrib-jshint": "~0.6.0", "grunt-contrib-clean": "~0.4.1", "grunt-contrib-copy": "~0.4.1", "grunt-contrib-concat": "~0.3.0", "grunt-exec": "~0.4.2", "grunt-string-replace": "~0.2.4", "grunt

Categories : Javascript

Multiple readers and multiple writers(i mean multiple) synchronization
If you are using pthreads, take a look at the synchronization approach in this question. You could use a similar approach with two variables readerCount and writerCount and a mutex. In a reader thread you would lock the mutex and wait for writerCount == 0. If this is condition is met, you increment the readerCount by 1 and release the lock. Then you do the reading. When you are done, you lock the mutex again, decrement the readerCount, signal the condition change and release the lock. The writer thread follows the same logic but waits for the condition readerCount == 0 and increments/decrements writerCount instead.

Categories : Unix

PHP SQL, Getting a multiple data from multiple table with multiple condition in PHP
Make a condition for job_taker and users like job_taker.user_id=users.user_id Query, $data_query ="SELECT users.user_name, jobs.job_code, jobs.job_desc, jobs.job_client, jobs.job_year, jobs.job_month, jobs.job_category, job_taker.job_hours FROM jobs,job_taker,users WHERE jobs.job_id = job_taker.job_id AND users.user_id ='$uid' AND job_taker.user_id=users.user_id ORDER BY 'login.jobs.job_id' DESC";

Categories : PHP

Best way to upload multiple files as part of a REST API? Single or multiple POST requests?
To do this, you'd need your client to upload in mime/multipart format. I don't know PHP, but I'm sure there's a library out there that will support receiving/parsing the multipart messages you get. As for whether it's a good idea .. If initiating the request is the creation of a single resource, it's not unreasonable to accept mime/multipart. If the parts being sent are themselves full-fledged resources, it would probably be better to make the client send them up separately, and reference them in the initiation request. Also note that mime/multipart is going to be a bit harder for your clients to deal with than simple requests. This post seems to be related to what you're trying to accomplish.

Categories : Api

Addressing multiple instances of SQLiteOpenHelper when there are multiple Content Providers for a single database
All you need is to make sure that you share one instance of SQLiteDatabase , SQLite automatically takes care of locking for same database. To make a database globally available, extend Application class: public class App extends Application { private static SQLiteDatabase db; public static SQLiteDatabase getDb() { return db; } @Override public void onCreate() { super.onCreate(); db = new MySQLiteOpenHelper(getApplicationContext()).getWritableDatabase(); } } and add it to manifest: <application android:name=".App" Now, you can access the database from any Activity/Fragment/Service by calling App.getDb()

Categories : Android

Moving multiple files to multiple directories based on filename pattern, while excluding some
I'm assuming that there are more that two 7-letter sequences at the beginning of your filenames (because otherwise you could just mv commands with bash extension). On bash, fist move the 'special' files with the letter sequence in the middle to the new directory: cd /data/myowndir/ for filename in *sT13*.*; do if [ "${filename: -4}" != ".nii" ]; then dir_name=${filename:0:5}; mkdir -p ${dir_name}struc mv -i $filename ${dir_name}struc/${filename} fi done then move all the other files to their respective new folders: for filename in *.*; do if [ "${filename: -4}" != ".nii" ]; then dir_name=${filename:0:7}; mkdir -p $dir_name mv -i $filename $dir_name/${filename} fi done the -p option for the mkdir command assures that you don't get error

Categories : Linux

Java servlet (tomcat) track multiple jdbc connections to multiple databases
You can instantiate the Tomcat's Connection Pool in your servlet. It should look like this: public class YourServlet extends HttpServlet { private DataSource ds; public void init(ServletConfig config) throws ServletException { org.apache.tomcat.jdbc.pool.PoolProperties prop; prop = new org.apache.tomcat.jdbc.pool.PoolProperties(); prop.setUrl("jdbc:mysql://localhost:3306/foo"); prop.setDriverClassName("com.mysql.jdbc.Driver"); prop.setUsername("user"); prop.setPassword("password"); org.apache.tomcat.jdbc.pool.DataSource dataSource; dataSource = new org.apache.tomcat.jdbc.pool.DataSource(); dataSource.setPoolProperties(prop); ds = dataSource; } protected void doGet(HttpServletRequest request, HttpServletResponse response) throws Ser

Categories : Tomcat

Is a Parse query fetching an Object multiple times when referenced by multiple rows?
The include is implemented as a separate query which gets all the objects pointed to by the initial query. So the answer is no, this object is not fetched again by each row that points to it, since all the included objects are fetched at once in a separate query.

Categories : Parse Com

Fastest/Easiest way to store multiple arrays of data for multiple time steps
Why not index via the particle id?: particles = struct; particles(id).t % length(t)-by-1 particles(id).x % length(t)-by-1 particles(id).y % length(t)-by-1 particles(id).xdot % length(t)-by-1 particles(id).ydot % length(t)-by-1 Then particles(id).x is a vector where each element corresponds to an element in particles(id).t. particles(1).x(1) would be the first x value for id 1. However, the problem with breaking things up with an id is that you won't be able to search across particles. I'd really just use arrays (or a struct containing arrays for all particles): particles = struct; particles.ids % 1-by-length(ids) particles.t % length(t)-by-1 or length(t)-by-length(ids) particles.x % length(t)-by-length(ids) particles.y % length(t)-by-length(ids) particles.xdot % leng

Categories : Arrays

Edit multiple lines of a file locally and then rename multiple times- Linux
You can try something next: LC_ALL=C for i in {1..6} do r=$(printf "%.1f" $i) theta=$(printf "%.1f" $(($i*15)) ) sed "s/theta = 0.0/theta = $theta/;s/r = 1.0/r = $r/;s/visual_1_0/visual_r_theta/" < n2o.inp >n2o_${r}_${theta}.inp done You should don't have spaces between = in the assignment. Calculation (integer only) in bash can be done with $(( expression )) syntax. The printf formats the number as floating point number with one decimal precision, and finally the 'LC_ALL=C' sets the locale to C - so, the printf prints decimal point and not a comma as in many international setting. (if you're has C or us and like, don't need the LC_ALL line). The above script produces from the input file: theta = 0.0 deg r = 1.0 put, molden, visual_1_0 ; the next 6 files theta =

Categories : Linux

Multiple texture units in shader vs multiple semitransparent textured meshes - performance
There is no question here, using multiple texture units will give you better performance. Generally speaking, the fewer trips your data have to take down the pipeline the quicker they will finish. So if you can cram more operations into a single fragment shader more power to you. The only reason you might consider doing otherwise is if you run into hardware limitations like the number of temporary registers or instruction slots used or texture image units, none of which are relevant in your simple example. Even on the most pathetic hardware capable of implementing OpenGL ES 2.0 you are guaranteed 8 texture units: const mediump int gl_MaxVertexTextureImageUnits = 0; // Vertex texture lookups are optional const mediump int gl_MaxCombinedTextureImageUnits = 8; const mediump int gl_MaxTextu

Categories : IOS

query column returns multiple readings and needs to be multiple cells in ssrs
Report-level You can use the Split function to take a delimited string and return an array; based on this you can specify the element you want from 0-7 to get your eight columns. In an expression you'd do something like this: =Split(fields!readings.Value, ";")(0) (1st element) or =Split(fields!readings.Value, ";")(7) (8th element) The problem with this is when there is less than 8 elements in the readings field; you will get an error reported - wrapping the expression in an IIf is not enough as this doesn't short circuit in SSRS and any problem string will error regardless. To deal with these issues you can move the logic to custom code embedded in the report: Function ElementByNumber(fieldValue As String, elementNumber As Integer) As String If Split(fieldValue, ";").Length <

Categories : Sql Server

how to attach multiple files to email and send it to multiple emailid dynamically php
<?php $to = 'youraddress@example.com'; $subject = 'Test email with attachment'; //create a boundary string. It must be unique //so we use the MD5 algorithm to generate a random hash $random_hash = md5(date('r', time())); //define the headers we want passed. Note that they are separated with $headers = "From: webmaster@example.com Reply-To: webmaster@example.com"; //add boundary string and mime type specification $headers .= " Content-Type: multipart/mixed; boundary="PHP-mixed-".$random_hash."""; //read the atachment file contents into a string, //encode it with MIME base64, //and split it into smaller chunks $attachment = chunk_split(base64_encode(file_get_contents('attachment.zip'))); //define the body of the message. ob_start(); //Turn on output buffering ?

Categories : PHP

How to provide multiple mapping manager for solr multiple cores in SolrNet
You can look at the SolrNet unit tests for Ninject with multiple cores - NinjectMultiCoreFixtures.cs for a working example. Also, if you are not using the mapping manager are you useing Attribute based mapping to get things setup? Because you will still need to setup the mapping between your SolrMarkup and SolrTranscript classes fo things to work properly.

Categories : Misc

Multiple apps from one code base - multiple projects or targets in Xcode?
I think you have at least 3 options here: Separate projects. It is more difficult to share code across projects, but with Xcode workspaces this is quite feasible. If you have a lot of customization for each project, this might make sense. Same project, more targets. This is the usual way this is done. It is very easy because you have a very neat overview of what files go into which target. If you have around, say, a dozen or so targets, it is really quite easy to handle. Separate git branches. I have worked with this in the past. The differences between the apps (Info.plist, configuration files, data files) are just swapped in the corresponding git branch. This is practical if you have a lot of data and don't need to have all of it available at all times. However, the complexity of gi

Categories : IOS

How to call multiple actions of multiple modules from different controller and combine the output?
Action View Helper will help you to accomplish this in modules/default/views/scripts/index/index.phtml <?php echo $this->action('index', 'index', 'module1')); ?> <?php echo $this->action('index', 'index', 'module2'); ?> But action view helper have several performance and debugging issues please see these links before deciding to use it How can I speed up calls to the action() view helper? Action View Helper in Zend - Work around? Using Action Helpers To Implement Re-Usable Widgets

Categories : PHP

MySQL Query: Multiple joins on the same field returning multiple categories - HOW?
I have now realised how the tables join together. What you want to do is possible with something like the following. It will be slow and the main reason I am putting it here is to show how nasty and unreadable it is, as an encouragement to normalise the database. SELECT * FROM cart c INNER JOIN prods p ON p.id = c.item INNER JOIN Category z1 ON FIND_IN_SET(CONCAT('i-', p.id), REPLACE(REPLACE(z1.arrange, 'i,', 'i-'), '|', ',')) > 0 INNER JOIN Category z2 ON FIND_IN_SET(CONCAT('c-', z1.id), REPLACE(REPLACE(z2.arrange, 'c,', 'c-'), '|', ',')) > 0 WHERE order_status = '' AND date_ordered != '0000-00-00' ORDER BY date_added DESC FIND_IN_SET is a function that looks for a value in a comma separated list. This is taking your delimited list, changing all the occurrences of i, and chang

Categories : Mysql

How to update multiple rows / How to perform Operation on multiple records (C#, SQL Server)
You need to define an UPDATE SQL statement to do your update call that UPDATE from your C# code use parametrized query to avoid SQL injection and bad performance !! put your usage of SqlConnection and SqlCommand into using() {....} blocks to ensure proper disposal Something like this: // define your UPDATE query string updateQuery = "UPDATE dbo.Players SET Score = Score + @Value WHERE Team_id = @TeamID"; // two nested "using" blocks for conenction and command using (SqlConnection conn = new SqlConnection(.....)) using (SqlCommand cmd = new SqlCommand(updateQuery, con)) { // define the parameters and provide values cmd.Parameters.Add("@Value", SqlDbType.Int).Value = someValue; cmd.Parameters.Add("@TeamID", SqlDbType.Int).Value = teamID; // open connection, execute t

Categories : Sql Server

Using IRepository pattern for multiple domain objects and multiple storage mechanisms
Please refer to How would I design a repository to handle multiple data access strategies? , I think this is what you want. Basically assume you already have one IRepository interface having methods of CRUD and other generic methods refer by all your other repository, then you have multi implementations to IRepository interface. After that use any IOC container (I use Windsor Castle) to resolve which implement's component should take part for this interface doing application setup.

Categories : C#

Deploy one web project with multiple connection strings to multiple deployment packages
To leverage config transformations for your environments - you need to create 5 different configurations, one for each server. Then just build each configuration before deploying to server. Another solution - is to call TransformXml task manually in your build script, so your single build can create 5 transformed configs in one run.

Categories : Dotnet

Export Access database with multiple tables to Excel with multiple sheets
Your db variable doesn't refer to the current database (yet - it is set in the following line), and the property is Name (I haven't encountered DatabaseName): Sub Test() Dim db As DAO.Database Set db = CurrentDb Dim sLast As String MsgBox db.Name 'F:Documents and SettingsstudentMy DocumentsStaff Database.accdb sLast = InStrRev(db.Name, "") MsgBox Right(db.Name, Len(db.Name) - sLast) 'Staff Database.accdb End Sub Name gives the full path and filename, the second MsgBox reduces this to just the filename. (There may be another way to get the filename without having to parse Name..) To get the number of rows exported you could open a Recordset for the table(s), reading the RecordCount property. A text file could be created using the FileSystemObject object.

Categories : Excel

mysql inner join same table and same column multiple times from multiple tables
Yes, the better way to do this for maintenance purposes is to create a view of only the inner joins and querying the view. Remember in terms of performance there would be little by way of improvement but maintenance of the code would become much easier. Given your purpose the inner joins are not entirely avoidable unless you decide to change the structure of the tables

Categories : Mysql

PHP: How to control multiple instances of Class in MVC (where multiple modules load) without Singleton
How about an inversion of control system? You could make a global IOC object that has instructions for creating an object, but that also has a registry that contains references to already created objects. In the registration portion of the module for each item that you want to behave "singletonny", you simply check to see if it's already been instantiated. The only other option I can think of is that since you aren't looking to construct anything, make it a static class that you can't instantiate and access the class statically (Calendar::printSomeFunction). I am not, however, opposed to the singleton pattern, for what it's worth, when it's used correctly. I just choose more elegant solutions such as #1 here, because it is very flexible. You don't however have much control over whether or

Categories : PHP

Merging multiple rows from one table into multiple colums in a SQL Query Result Set
You can use the PIVOT function to get the result, this function converts your rows of data into columns. If you have a limited number of PictureURLs for each building, then you can hard-code the query: select BuildingNumber, bldgname, floors, sqft, PictureURL1, PictureURL2, PictureURL3 from ( select b.BuildingNumber, b.bldgname, b.floors, b.sqft, p.PictureURL, col = 'PictureURL'+ cast(row_number() over(partition by b.BuildingNumber order by b.BuildingNumber) as varchar(10)) from building b inner join picture p on b.BuildingNumber = p.BuildingNumber ) d pivot ( max(PictureURL) for col in (PictureURL1, PictureURL2, PictureURL3) ) piv; See SQL Fiddle with Demo. But if you have an unknown number of values, then you wil

Categories : SQL

find multiple records on basis of multiple fields in mysql table
If I understood you correctly, this query would work for you: SELECT p1.id, p1.name, p1.sku, p1.programme FROM product p1 JOIN product p2 ON p1.sku = p2.sku AND p1. programme <> p2.programme If not then please add some sample data and expected result. Based on sample data, try this query: SELECT * FROM product WHERE id IN( SELECT p1.id FROM (SELECT MIN(id) as id, sku, programme FROM product GROUP BY sku, programme) p1 JOIN (SELECT MIN(id) as id, sku, programme FROM product GROUP BY sku, programme) p2 ON p1.sku = p2.sku AND p1.programme <> p2.programme )

Categories : Mysql

PHP: session_start() called 'simultaneously' in multiple tabs creates multiple sessions
I doubt one process if overwriting the other. Only one process can have the same session file open at any time. The 2nd (and subsequent) will hang waiting for the session file to become available. From my experience, $_SESSION isn't really as magical as it seems, it just uses browser cookies or something to make sure reads from and writes to the same file on disk every time. I got around this problem previously by only using session_start() when I needed. In other words, instead of opening the session at the top of every page, I did a session_start immediately before writing or retrieving information from $_SESSION and did a session_write_close as soon as I was done with it.

Categories : PHP

Database Design: Multiple User Entities. Single or Multiple Tables
Option 1 looks better to me. It will simplify your code when you don't care to distinguish students from coaches, and will be pretty much the same as option 2 if you want to distinguish them. If you really need to validate the foreign keys you can use triggers to check if its a coach or not. I'm not sure what you mean by "Potential polymorphism issues and the need to normalise down the track.".

Categories : PHP



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